mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-16 16:34:05 +00:00
Merge branch 'master' of github.com:pmmp/PocketMine-MP
This commit is contained in:
commit
99e68fb5d3
@ -46,7 +46,13 @@ class Bow extends Tool implements Releasable{
|
||||
|
||||
public function onReleaseUsing(Player $player) : ItemUseResult{
|
||||
$arrow = VanillaItems::ARROW();
|
||||
if($player->hasFiniteResources() and !$player->getInventory()->contains($arrow)){
|
||||
$inventory = match(true){
|
||||
$player->getOffHandInventory()->contains($arrow) => $player->getOffHandInventory(),
|
||||
$player->getInventory()->contains($arrow) => $player->getInventory(),
|
||||
default => null
|
||||
};
|
||||
|
||||
if($player->hasFiniteResources() and $inventory === null){
|
||||
return ItemUseResult::FAIL();
|
||||
}
|
||||
|
||||
@ -110,7 +116,7 @@ class Bow extends Tool implements Releasable{
|
||||
|
||||
if($player->hasFiniteResources()){
|
||||
if(!$infinity){ //TODO: tipped arrows are still consumed when Infinity is applied
|
||||
$player->getInventory()->removeItem($arrow);
|
||||
$inventory?->removeItem($arrow);
|
||||
}
|
||||
$this->applyDamage(1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user