Fixed really dumb copy bug breaking crafting

This commit is contained in:
Dylan K. Taylor 2017-07-22 12:04:52 +01:00
parent 6cacb368ce
commit f32e880542
2 changed files with 3 additions and 3 deletions

View File

@ -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));

View File

@ -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();
}
/**