Skip to content

Commit cc07bc2

Browse files
committed
Remove NameHistory from Library
1 parent f02ecd6 commit cc07bc2

File tree

3 files changed

+54
-50
lines changed

3 files changed

+54
-50
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ Get Value from UUID:
1818
`MojangAPI::getValueFromUUID('8d0a41175a764b72a7dc67b555119fef');`
1919
Result: ewogICJ0aW1lc3RhbXAiIDogMT...
2020

21-
Get All Names from UUID:
22-
`MojangAPI::getAllNamesFromUUID('8d0a41175a764b72a7dc67b555119fef);`
23-
Result: ["LordRazen"]
24-
2521
Check if Skinfile Exists:
2622
http://textures.minecraft.net/texture/d5c6dc2bbf51c36cfc7714585a6a5683ef2b14d47d8ff714654a893f5da622
2723
`MojangAPI::validateSkinFileExists('d5c6dc2bbf51c36cfc7714585a6a5683ef2b14d47d8ff714654a893f5da622');`
@@ -31,6 +27,11 @@ Get Skinfile from Mojang Skin Servers:
3127
`MojangAPI::getSkinFile('d5c6dc2bbf51c36cfc7714585a6a5683ef2b14d47d8ff714654a893f5da622');`
3228
Result: GdImage
3329

30+
## Former Features
31+
Get All Names from UUID (deprecated since Mojang stopped the API support):
32+
`MojangAPI::getAllNamesFromUUID('8d0a41175a764b72a7dc67b555119fef);`
33+
Result: ["LordRazen"]
34+
3435
<br>
3536
<hr>
3637
www.minecraft-heads.com

src/MojangAPI.php

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -110,32 +110,35 @@ public static function getSkinFile(String $url): mixed
110110
return false;
111111
}
112112

113-
/**
114-
* Get all playernames from a UUID
115-
*
116-
* @param String $uuid (Trimmed)
117-
* @return mixed false|array $playernames
118-
*/
119-
public static function getAllNamesFromUUID(String $uuid): mixed
120-
{
121-
$request = self::MOJANG_NAMES_FROM_UUID_PART1 . $uuid . self::MOJANG_NAMES_FROM_UUID_PART2;
122-
$response = json_decode(@file_get_contents($request));
123-
124-
# No response, return false
125-
if ($response == NULL)
126-
return false;
127-
128-
# Return playernames
129-
$playernames = array();
130-
foreach ($response as $playername) {
131-
if (empty($playername->changedToAt)) {
132-
$playernames[0] = $playername->name;
133-
} else {
134-
# Cut of last three characters from timestamp. The timestamp is in Milliseconds, but seconds are needed
135-
$playernames[substr($playername->changedToAt, 0, -3)] = $playername->name;
136-
}
137-
}
138-
139-
return $playernames;
140-
}
113+
// /**
114+
// * Get all playernames from a UUID
115+
// *
116+
// * MOJANG STOPPED THIS API! DEPRECATED METHOD!
117+
// *
118+
// * @deprecated
119+
// * @param String $uuid (Trimmed)
120+
// * @return mixed false|array $playernames
121+
// */
122+
// public static function getAllNamesFromUUID(String $uuid): mixed
123+
// {
124+
// $request = self::MOJANG_NAMES_FROM_UUID_PART1 . $uuid . self::MOJANG_NAMES_FROM_UUID_PART2;
125+
// $response = json_decode(@file_get_contents($request));
126+
127+
// # No response, return false
128+
// if ($response == NULL)
129+
// return false;
130+
131+
// # Return playernames
132+
// $playernames = array();
133+
// foreach ($response as $playername) {
134+
// if (empty($playername->changedToAt)) {
135+
// $playernames[0] = $playername->name;
136+
// } else {
137+
// # Cut of last three characters from timestamp. The timestamp is in Milliseconds, but seconds are needed
138+
// $playernames[substr($playername->changedToAt, 0, -3)] = $playername->name;
139+
// }
140+
// }
141+
142+
// return $playernames;
143+
// }
141144
}

tests/MojangApiTest.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -149,23 +149,23 @@ public function dataSetSkinFiles()
149149
];
150150
}
151151

152-
/**
153-
* Test getAllNamesFromUUID()
154-
*
155-
* @test
156-
* @dataProvider dataSetNames
157-
*/
158-
public function testGetAllNamesFromUUID(String $uuid, String $names)
159-
{
160-
$result = MojangAPI::getAllNamesFromUUID($uuid);
161-
$this->assertEquals(json_encode($result), $names);
162-
}
152+
// /**
153+
// * Test getAllNamesFromUUID()
154+
// *
155+
// * @test
156+
// * @dataProvider dataSetNames
157+
// */
158+
// public function testGetAllNamesFromUUID(String $uuid, String $names)
159+
// {
160+
// $result = MojangAPI::getAllNamesFromUUID($uuid);
161+
// $this->assertEquals(json_encode($result), $names);
162+
// }
163163

164-
public function dataSetNames()
165-
{
166-
return [
167-
['8d0a41175a764b72a7dc67b555119fef', '["LordRazen"]'],
168-
['dcd9538627ff49f793dabeb125058df2', '{"0":"BadLady1998","1512312932":"MissPrincess98","1586369437":"Missi98"}']
169-
];
170-
}
164+
// public function dataSetNames()
165+
// {
166+
// return [
167+
// ['8d0a41175a764b72a7dc67b555119fef', '["LordRazen"]'],
168+
// ['dcd9538627ff49f793dabeb125058df2', '{"0":"BadLady1998","1512312932":"MissPrincess98","1586369437":"Missi98"}']
169+
// ];
170+
// }
171171
}

0 commit comments

Comments
 (0)