-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathmojang-api.interface.php
More file actions
243 lines (218 loc) · 6.86 KB
/
mojang-api.interface.php
File metadata and controls
243 lines (218 loc) · 6.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<?php
/**
* Fast and easy way to access Mojang API
*
* This interface is NOT needed in your project
*
* @author MineTheCube
* @link https://github.com/MineTheCube/MojangAPI
* @see http://wiki.vg/Mojang_API
*/
interface MojangAPI
{
/**
* Get Mojang status
*
* @deprecated Mojang removed the API endpoint
*
* @return array|bool Array with status, FALSE on failure
*/
public static function getStatus();
/**
* Get UUID from username, an optional time can be provided
*
* @param string $username
* @param int $time optional
* @return string|bool UUID (without dashes) on success, FALSE on failure
*/
public static function getUuid($username, $time = 0);
/**
* Get username from UUID
*
* @param string $uuid
* @return string|bool Username on success, FALSE on failure
*/
public static function getUsername($uuid);
/**
* Get profile (username and UUID) from username, an optional time can be provided
*
* @param string $username
* @param int $time optional
* @return array|bool Array with id and name, FALSE on failure
*/
public static function getProfile($username, $time = 0);
/**
* Get name history from UUID
*
* @deprecated Mojang removed the API endpoint
*
* @param string $uuid
* @return array|bool Array with his username's history, FALSE on failure
*/
public static function getNameHistory($uuid);
/**
* Check if string is a valid Minecraft username
*
* @param string $string to check
* @return bool Whether username is valid or not
*/
public static function isValidUsername($string);
/**
* Check if string is a valid UUID, with or without dashes
*
* @param string $string to check
* @return bool Whether UUID is valid or not
*/
public static function isValidUuid($string);
/**
* Remove dashes from UUID
*
* @param string $uuid
* @return string|bool UUID without dashes (32 chars), FALSE on failure
*/
public static function minifyUuid($uuid);
/**
* Add dashes to an UUID
*
* @param string $uuid
* @return string|bool UUID with dashes (36 chars), FALSE on failure
*/
public static function formatUuid($uuid);
/**
* Check if username is Alex or Steve is a valid UUID, with or without dashes
*
* @param string $uuid
* @return bool|null TRUE if Alex, FALSE if Steve, NULL on error
*/
public static function isAlex($uuid);
/**
* Get profile (username and UUID) from UUID
*
* This has a rate limit to 1 per minute per profile
*
* @param string $uuid
* @return array|bool Array with profile and properties, FALSE on failure
*/
public static function getSessionProfile($uuid);
/**
* Get textures (usually skin and cape, or empty array) from UUID
*
* This has a rate limit to 1 per minute per profile
* @see getSessionProfile($uuid)
*
* @param string $uuid
* @return array|bool Array with profile and properties, FALSE on failure
*/
public static function getTextures($uuid);
/**
* Get skin url of player
*
* This has a rate limit to 1 per minute per profile
* @see getSessionProfile($uuid)
*
* @param string $uuid
* @return string|null|bool Skin url, NULL if he hasn't a skin, FALSE on failure
*/
public static function getSkinUrl($uuid);
/**
* Get skin (in raw png) of player
*
* This has a rate limit to 1 per minute per profile
* @see getSessionProfile($uuid)
*
* @param string $uuid
* @return string|null|bool Skin picture, NULL if he hasn't a skin, FALSE on failure
*/
public static function getSkin($uuid);
/**
* Get player head (in raw png) of player
*
* This has a rate limit to 1 per minute per profile
* @see getSessionProfile($uuid)
*
* @param string $uuid
* @param int $size in pixels
* @return string|null|bool Player head, NULL if he hasn't a skin, FALSE on failure
*/
public static function getPlayerHead($uuid, $size = 100);
/**
* Get Steve skin (in raw png)
*
* @return string Steve skin
*/
public static function getSteveSkin();
/**
* Get Alex skin (in raw png)
*
* @return string Alex skin
*/
public static function getAlexSkin();
/**
* Get Steve head (in raw png)
*
* @return string Steve head
*/
public static function getSteveHead($size = 100);
/**
* Get Alex head (in raw png)
*
* @return string Alex head
*/
public static function getAlexHead($size = 100);
/**
* Get player head (in raw png) from skin
*
* @param string $skin returned by getSkin($uuid)
* @param int $size in pixels
* @return string|bool Player head, FALSE on failure
*/
public static function getPlayerHeadFromSkin($skin, $size = 100);
/**
* Print image from raw png
*
* Nothing should be displayed on the page other than this image
*
* @param string $img
* @param int $cache in seconds, 0 to disable
*/
public static function printImage($img, $cache = 86400);
/**
* Embed image for <img> tag
*
* @param string $img
* @return string embed image
*/
public static function embedImage($img);
/**
* Authenticate with a Minecraft account
*
* After a few fails, Mojang server will deny all requests !
*
* @param string $id Minecraft username or Mojang email
* @param string $password Account's password
* @return array|bool Array with id and name, FALSE if authentication failed
*/
public static function authenticate($id, $password);
/**
* Query a Minecraft server
*
* @see https://github.com/xPaw/PHP-Minecraft-Query/
*
* @param string $address Server's address
* @param int $port Server's port, default is 25565
* @param int $timeout Timeout (in seconds), default is 2
* @return array|bool Array with query result, FALSE if query failed
*/
public static function query($address, $port = 25565, $timeout = 2);
/**
* Ping a Minecraft server
*
* @see https://github.com/xPaw/PHP-Minecraft-Query/
*
* @param string $address Server's address
* @param int $port Server's port, default is 25565
* @param int $timeout Timeout (in seconds), default is 2
* @return array|bool Array with query result, FALSE if query failed
*/
public static function ping($address, $port = 25565, $timeout = 2);
}