mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
@ -23,6 +23,7 @@
|
||||
* Various Utilities used around the code
|
||||
*/
|
||||
namespace pocketmine\utils;
|
||||
|
||||
use pocketmine\ThreadManager;
|
||||
|
||||
/**
|
||||
@ -462,8 +463,8 @@ class Utils{
|
||||
/**
|
||||
* GETs an URL using cURL
|
||||
*
|
||||
* @param $page
|
||||
* @param int $timeout default 10
|
||||
* @param $page
|
||||
* @param int $timeout default 10
|
||||
* @param array $extraHeaders
|
||||
*
|
||||
* @return bool|mixed
|
||||
@ -496,7 +497,7 @@ class Utils{
|
||||
* @param $page
|
||||
* @param array|string $args
|
||||
* @param int $timeout
|
||||
* @param array $extraHeaders
|
||||
* @param array $extraHeaders
|
||||
*
|
||||
* @return bool|mixed
|
||||
*/
|
||||
@ -524,4 +525,22 @@ class Utils{
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function javaStringHash($string){
|
||||
$hash = 0;
|
||||
for($i = 0; $i < strlen($string); $i++){
|
||||
$ord = ord($string{$i});
|
||||
if($ord & 0x80){
|
||||
$ord -= 0x100;
|
||||
}
|
||||
$hash = 31 * $hash + $ord;
|
||||
while($hash > 0x7FFFFFFF){
|
||||
$hash -= 0x100000000;
|
||||
}
|
||||
while($hash < -0x80000000){
|
||||
$hash += 0x100000000;
|
||||
}
|
||||
$hash &= 0xFFFFFFFF;
|
||||
}
|
||||
return $hash;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user