mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 08:39:53 +00:00
Send inventory on invalid crafting/invalid movement of item
This commit is contained in:
parent
daf3198136
commit
2b15c440ee
@ -341,7 +341,7 @@ class BlockAPI{
|
||||
}
|
||||
}
|
||||
|
||||
if((!$target->isBreakable($item, $player) and $this->server->api->dhandle("player.block.break.invalid", array("player" => $player, "target" => $target, "item" => $item)) !== true) or ($player->gamemode & 0x02) === 0x02 or (($player->lastBreak - $player->getLag() / 1000) + $target->getBreakTime($item, $player) - 0.1) >= microtime(true)){
|
||||
if((!$target->isBreakable($item, $player) and $this->server->api->dhandle("player.block.break.invalid", array("player" => $player, "target" => $target, "item" => $item)) !== true) or ($player->gamemode & 0x02) === 0x02 or (($player->lastBreak - $player->getLag() / 1000) + $target->getBreakTime($item, $player) - 0.2) >= microtime(true)){
|
||||
if($this->server->api->dhandle("player.block.break.bypass", array("player" => $player, "target" => $target, "item" => $item)) !== true){
|
||||
return $this->cancelAction($target, $player, false);
|
||||
}
|
||||
|
@ -2170,6 +2170,7 @@ class Player{
|
||||
if($item->getID() !== AIR and $slot->getID() == $item->getID()){
|
||||
if($slot->count < $item->count){
|
||||
if($this->removeItem($item->getID(), $item->getMetadata(), $item->count - $slot->count, false) === false){
|
||||
$this->sendInventory();
|
||||
break;
|
||||
}
|
||||
}elseif($slot->count > $item->count){
|
||||
@ -2177,6 +2178,7 @@ class Player{
|
||||
}
|
||||
}else{
|
||||
if($this->removeItem($item->getID(), $item->getMetadata(), $item->count, false) === false){
|
||||
$this->sendInventory();
|
||||
break;
|
||||
}
|
||||
$this->addItem($slot->getID(), $slot->getMetadata(), $slot->count, false);
|
||||
@ -2216,6 +2218,7 @@ class Player{
|
||||
if($item->getID() !== AIR and $slot->getID() == $item->getID()){
|
||||
if($slot->count < $item->count){
|
||||
if($this->removeItem($item->getID(), $item->getMetadata(), $item->count - $slot->count, false) === false){
|
||||
$this->sendInventory();
|
||||
break;
|
||||
}
|
||||
}elseif($slot->count > $item->count){
|
||||
@ -2223,6 +2226,7 @@ class Player{
|
||||
}
|
||||
}else{
|
||||
if($this->removeItem($item->getID(), $item->getMetadata(), $item->count, false) === false){
|
||||
$this->sendInventory();
|
||||
break;
|
||||
}
|
||||
$this->addItem($slot->getID(), $slot->getMetadata(), $slot->count, false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user