mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +00:00
Player: fix crash handling resource pack requests
This commit is contained in:
parent
0ac87989dc
commit
de09c8c082
@ -2061,7 +2061,13 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
case ResourcePackClientResponsePacket::STATUS_SEND_PACKS:
|
case ResourcePackClientResponsePacket::STATUS_SEND_PACKS:
|
||||||
$manager = $this->server->getResourcePackManager();
|
$manager = $this->server->getResourcePackManager();
|
||||||
foreach($packet->packIds as $uuid){
|
foreach($packet->packIds as $uuid){
|
||||||
$pack = $manager->getPackById(substr($uuid, 0, strpos($uuid, "_"))); //dirty hack for mojang's dirty hack for versions
|
//dirty hack for mojang's dirty hack for versions
|
||||||
|
$splitPos = strpos($uuid, "_");
|
||||||
|
if($splitPos !== false){
|
||||||
|
$uuid = substr($uuid, 0, $splitPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
$pack = $manager->getPackById($uuid);
|
||||||
if(!($pack instanceof ResourcePack)){
|
if(!($pack instanceof ResourcePack)){
|
||||||
//Client requested a resource pack but we don't have it available on the server
|
//Client requested a resource pack but we don't have it available on the server
|
||||||
$this->close("", "disconnectionScreen.resourcePack", true);
|
$this->close("", "disconnectionScreen.resourcePack", true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user