Add Releasable interface (#3664)

closes #3301
This commit is contained in:
Govdim
2020-06-30 23:09:10 +03:00
committed by GitHub
parent 74a919353f
commit 7f81507ea1
4 changed files with 35 additions and 4 deletions

View File

@ -78,6 +78,7 @@ use pocketmine\item\enchantment\EnchantmentInstance;
use pocketmine\item\enchantment\MeleeWeaponEnchantment;
use pocketmine\item\Item;
use pocketmine\item\ItemUseResult;
use pocketmine\item\Releasable;
use pocketmine\lang\Language;
use pocketmine\lang\TranslationContainer;
use pocketmine\math\Vector3;
@ -1476,8 +1477,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
$this->inventory->setItemInHand($item);
}
//TODO: check if item has a release action - if it doesn't, this shouldn't be set
$this->setUsingItem(true);
$this->setUsingItem($item instanceof Releasable);
return true;
}