mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Removed @deprecated classes, methods and properties, added some type hints
This commit is contained in:
@ -49,34 +49,6 @@ class Utils{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static function randomUUID(){
|
||||
return Utils::toUUID(Binary::writeInt(time()) . Binary::writeShort(getmypid()) . Binary::writeShort(getmyuid()) . Binary::writeInt(mt_rand(-0x7fffffff, 0x7fffffff)) . Binary::writeInt(mt_rand(-0x7fffffff, 0x7fffffff)), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static function dataToUUID(...$params){
|
||||
return Utils::toUUID(hash("md5", implode($params), true), 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static function toUUID($data, $version = 2, $fixed = "8"){
|
||||
if(strlen($data) !== 16){
|
||||
throw new \InvalidArgumentException("Data must be 16 bytes");
|
||||
}
|
||||
|
||||
$hex = bin2hex($data);
|
||||
|
||||
//xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx 8-4-4-12
|
||||
return substr($hex, 0, 8) . "-" . substr($hex, 8, 4) . "-" . hexdec($version) . substr($hex, 13, 3) . "-" . $fixed{0} . substr($hex, 17, 3) . "-" . substr($hex, 20, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets this machine / server instance unique ID
|
||||
* Returns a hash, the first 32 characters (or 16 if raw)
|
||||
|
Reference in New Issue
Block a user