diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index ae20ed50f..e06619371 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1527,7 +1527,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener, } public function getDrops() : array{ - if(!$this->isCreative()){ + if($this->hasFiniteResources()){ return parent::getDrops(); } @@ -1535,7 +1535,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener, } public function getXpDropAmount() : int{ - if(!$this->isCreative()){ + if($this->hasFiniteResources()){ return parent::getXpDropAmount(); } @@ -2052,7 +2052,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener, }else{ $this->inventory->swap($this->inventory->getHeldItemIndex(), $existing); } - }elseif($this->isCreative(true)){ //TODO: plugins won't know this isn't going to execute + }elseif(!$this->hasFiniteResources()){ //TODO: plugins won't know this isn't going to execute $firstEmpty = $this->inventory->firstEmpty(); if($firstEmpty === -1){ //full inventory $this->inventory->setItemInHand($item); diff --git a/src/pocketmine/entity/object/Painting.php b/src/pocketmine/entity/object/Painting.php index 18d143704..e5ea041cd 100644 --- a/src/pocketmine/entity/object/Painting.php +++ b/src/pocketmine/entity/object/Painting.php @@ -100,7 +100,7 @@ class Painting extends Entity{ if($this->lastDamageCause instanceof EntityDamageByEntityEvent){ $killer = $this->lastDamageCause->getDamager(); - if($killer instanceof Player and $killer->isCreative()){ + if($killer instanceof Player and !$killer->hasFiniteResources()){ $drops = false; } } diff --git a/src/pocketmine/inventory/transaction/action/CreativeInventoryAction.php b/src/pocketmine/inventory/transaction/action/CreativeInventoryAction.php index af861c00f..4b1f61803 100644 --- a/src/pocketmine/inventory/transaction/action/CreativeInventoryAction.php +++ b/src/pocketmine/inventory/transaction/action/CreativeInventoryAction.php @@ -52,7 +52,7 @@ class CreativeInventoryAction extends InventoryAction{ * @return bool */ public function isValid(Player $source) : bool{ - return $source->isCreative(true) and + return !$source->hasFiniteResources() and ($this->actionType === self::TYPE_DELETE_ITEM or Item::getCreativeItemIndex($this->sourceItem) !== -1); } diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 10743f696..603cffb58 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -1672,12 +1672,12 @@ class Level implements ChunkManager, Metadatable{ } $drops = []; - if($player === null or !$player->isCreative()){ + if($player === null or $player->hasFiniteResources()){ $drops = array_merge(...array_map(function(Block $block) use ($item) : array{ return $block->getDrops($item); }, $affectedBlocks)); } $xpDrop = 0; - if($player !== null and !$player->isCreative()){ + if($player !== null and $player->hasFiniteResources()){ $xpDrop = array_sum(array_map(function(Block $block) use ($item) : int{ return $block->getXpDropForTool($item); }, $affectedBlocks)); }