Skip to content

Instantly share code, notes, and snippets.

@jasonw4331
Last active July 25, 2017 14:50
Show Gist options
  • Select an option

  • Save jasonw4331/40e3075a25d394357f7c562bc237b143 to your computer and use it in GitHub Desktop.

Select an option

Save jasonw4331/40e3075a25d394357f7c562bc237b143 to your computer and use it in GitHub Desktop.
PMMP plugin script that clears inventories on player quit for UHC
<?php
/**
* @name InvClear
* @main jasonwynn10\InvClear\MainClass
* @version 0.1.0
* @api 3.0.0-ALPHA5
* @description A plugin script that clears inventories on player quit for UHC
* @author jasonwynn10
*/
namespace jasonwynn10\InvClear{
use pocketmine\event\Listener;
use pocketmine\event\PlayerQuitEvent;
use pocketmine\plugin\PluginBase;
class MainClass extends PluginBase implements Listener {
public function onEnable() {
$this->getServer()->getPluginManager()->registerEvents($this, $this);
}
public function onQuit(PlayerQuitEvent $ev) {
for($i = 0; $i <= $ev->getPlayer()->getInventory()->getSize(); $i++) {
$ev->getPlayer()->getInventory()->clear($i);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment