Code: public function onDeath (PlayerDeathEvent $ev){ $ev->setKeepInventory(true); } It just that I commerce this code But player still lose their inventory and I don't know why???? I use PocketMine-MP
Code: public function PlayerDeath(PlayerDeathEvent $event){ $event->setKeepInventory(true); } and must check in "public function onEnable" have " $this->getServer()->getPluginManager()->registerEvents($this, $this);"
Well, I have add the public function with registerEvent, but still it drop when death..... I have checked all of my plugin 3 time in a row and nothing conflict the KeepInventory, I don't know why I use spoon, the keepinventory code is working, but when I use PMMP, it doesn't
One change of an argument name and the function name won't make a difference. Also make sure you are implementing Listener in whatever class this is in (main class or a seperate class) & don't blindly copy in $this->getServer()->getPluginManager()->registerEvents($this, $this);. The first argument should be your listener. Only use the given code if you're using your main class as a listener. Otherwise, create an instance of your Listener as your first argument. P.S Please don't mention sp**ns in this forums
Ok it seemed that I have tested this Please don't facepalm me, I know what I am doing here It is not working, player still lose inventory when death I tested with all my plugin out and I don't know why????