diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 032530e7e..04d4dd72f 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -2924,7 +2924,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ if(!$canCraft or !$recipe->getResult()->equals($result)){ $this->server->getLogger()->debug("Unmatched recipe " . $recipe->getId() . " from player " . $this->getName() . ": expected " . $recipe->getResult() . ", got " . $result . ", using: " . implode(", ", $ingredients)); $this->inventory->sendContents($this); - return true; + return false; } $used = array_fill(0, $this->inventory->getSize(), 0); @@ -2948,7 +2948,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ if(!$canCraft){ $this->server->getLogger()->debug("Unmatched recipe " . $recipe->getId() . " from player " . $this->getName() . ": client does not have enough items, using: " . implode(", ", $ingredients)); $this->inventory->sendContents($this); - return true; + return false; } $this->server->getPluginManager()->callEvent($ev = new CraftItemEvent($this, $ingredients, $recipe)); diff --git a/src/pocketmine/network/mcpe/protocol/PacketPool.php b/src/pocketmine/network/mcpe/protocol/PacketPool.php index 39cbf1877..8cd7a99f3 100644 --- a/src/pocketmine/network/mcpe/protocol/PacketPool.php +++ b/src/pocketmine/network/mcpe/protocol/PacketPool.php @@ -140,7 +140,7 @@ class PacketPool{ * @return DataPacket */ public static function getPacketById(int $pid) : DataPacket{ - return static::$pool[$pid] ?? new UnknownPacket(); + return isset(static::$pool[$pid]) ? clone static::$pool[$pid] : new UnknownPacket(); } /**