mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Improved slot selection on creative mode, closes #2960
This commit is contained in:
@ -108,13 +108,6 @@ class PlayerInventory extends BaseInventory{
|
||||
|
||||
$itemIndex = $this->getHeldItemIndex();
|
||||
|
||||
for($i = 0; $i < $this->getHotbarSize(); ++$i){
|
||||
if($this->getHotbarSlotIndex($i) === $slot){
|
||||
$itemIndex = $i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($this->getHolder() instanceof Player){
|
||||
Server::getInstance()->getPluginManager()->callEvent($ev = new PlayerItemHeldEvent($this->getHolder(), $item, $slot, $itemIndex));
|
||||
if($ev->isCancelled()){
|
||||
@ -124,7 +117,6 @@ class PlayerInventory extends BaseInventory{
|
||||
}
|
||||
|
||||
$this->setHotbarSlotIndex($itemIndex, $slot);
|
||||
$this->setHeldItemIndex($itemIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user