Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

InventoryClear v2.0.0

Clear players inventory on Join, Leave, Death and with a command!

  1. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    I'll add a check to make sure its an instanceof PlayerInventory in v1.3
  2. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    how do you call the function clearInventory?
    $this->clearInventory("Steve"); ? because if this is how you do it, then its your fault.
  3. CaptainKenji17
    Offline

    CaptainKenji17 Active Member

    Joined:
    Apr 22, 2014
    Posts:
    252
    Minecraft User:
    CaptainKenji17

    why my fault you said you replace it not I did replace it now there look "blablabla clearinventory("steve")"....

    Thanks good tutorial....

    I can have no entity drop when player died with spawnmgr plugin
  4. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    it wont crash or do something if that function isnt used or called!
    it is obviously used. why dont you show your whole code so we could check it out?
  5. CaptainKenji17
    Offline

    CaptainKenji17 Active Member

    Joined:
    Apr 22, 2014
    Posts:
    252
    Minecraft User:
    CaptainKenji17
    */

    namespace InventoryClear;

    use pocketmine\plugin\PluginBase;
    use pocketmine\event\Listener;
    use pocketmine\utils\TextFormat;
    use pocketmine\Player;
    use pocketmine\item\Item;
    use pocketmine\event\Event;
    use pocketmine\player\inventory;


    class Main extends PluginBase implements Listener {

    public function onLoad() {
    $this->getLogger()->info(TextFormat::BLUE . "Loading InventoryClear v1.0 By CrazedMiner....");
    }

    public function onEnable() {
    $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this);
    $this->getCommand("clearinv")->setExecutor(new ClearInvCommand($this));

    if(!file_exists($this->getDataFolder() . "config.yml")) {
    @mkdir($this->getDataFolder());
    file_put_contents($this->getDataFolder() . "config.yml",$this->getResource("config.yml"));
    }

    $this->getLogger()->info(TextFormat::GREEN . "InventoryClear v1.0 By CrazedMiner Enabled!");
    }

    public function onDisable() {
    $this->getLogger()->info(TextFormat::DARK_GREEN . "InventoryClear v1.0 By CrazedMiner Disabled!");
    }

    public function clearInventory($player){
    if($player instanceof Player){
    $player->getInventory()->clearAll();
    }
    }

    public function clearDrops(Event $event) {
    $event->setDrops(array(Item::get(0, 0, 0)));
    }

    }
  6. CaptainKenji17
    Offline

    CaptainKenji17 Active Member

    Joined:
    Apr 22, 2014
    Posts:
    252
    Minecraft User:
    CaptainKenji17
    Code:
     */
    
    namespace InventoryClear;
    
    use pocketmine\plugin\PluginBase;
    use pocketmine\event\Listener;
    use pocketmine\utils\TextFormat;
    use pocketmine\Player;
    use pocketmine\item\Item;
    use pocketmine\event\Event;
    use pocketmine\player\inventory;
    
    
    class Main extends PluginBase implements Listener {
    
        public function onLoad() {
            $this->getLogger()->info(TextFormat::BLUE . "Loading InventoryClear v1.0 By CrazedMiner....");
        }
    
        public function onEnable() {
            $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this);
            $this->getCommand("clearinv")->setExecutor(new ClearInvCommand($this));
           
            if(!file_exists($this->getDataFolder() . "config.yml")) {
                @mkdir($this->getDataFolder());
                file_put_contents($this->getDataFolder() . "config.yml",$this->getResource("config.yml"));
            }
           
            $this->getLogger()->info(TextFormat::GREEN . "InventoryClear v1.0 By CrazedMiner Enabled!");
        }
    
        public function onDisable() {
            $this->getLogger()->info(TextFormat::DARK_GREEN . "InventoryClear v1.0 By CrazedMiner Disabled!");
        }
    
        public function clearInventory($player){
         if($player instanceof Player){
              $player->getInventory()->clearAll();
            }
        }
       
        public function clearDrops(Event $event) {
            $event->setDrops(array(Item::get(0, 0, 0)));
        }
       
    }
  7. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
  8. EmeraldGem585
    Offline

    EmeraldGem585 New Member

    Joined:
    Nov 26, 2015
    Posts:
    9
    Minecraft User:
    EmeraldGem585
    How do i clear the players inventory when they execute a command? Or does it auto clear?
  9. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    The config allows you to make a players inventory clear on certain events and there is the /clearinv command.
    Vaivez66 likes this.
  10. EmeraldGem585
    Offline

    EmeraldGem585 New Member

    Joined:
    Nov 26, 2015
    Posts:
    9
    Minecraft User:
    EmeraldGem585
    Ah ok, I misread the plug wrong. I thought it cleared when they executed commands. Thanks for the help xD
  11. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
  12. VoBIs
    Offline

    VoBIs New Member

    Joined:
    Jun 20, 2015
    Posts:
    18
    Minecraft User:
    VoBIs
    Genisys Crash Dump Wed Feb 24 07:43:12 AMT 2016

    Error: Class inventoryclear\Main not found
    File: /src/spl/BaseClassLoader
    Line: 144
    Type: notice

    THIS CRASH WAS CAUSED BY A PLUGIN
    此次出错由插件引起

    Code:
    [135]
    [136] if(\method_exists($name, "onClassLoaded") and (new ReflectionClass($name))->getMethod("onClassLoaded")->isStatic()){
    [137] $name::eek:nClassLoaded();
    [138] }
    [139]
    [140] $this->classes[] = $name;
    [141]
    [142] return \true;
    [143] }elseif($this->getParent() === \null){
    [144] throw new ClassNotFoundException("Class $name not found");
    [145] }
    [146]
    [147] return \false;
    [148] }
    [149]
    [150] /**
    [151] * Returns the path for the class, if any
    [152] *
    [153] * @param string $name
    [154] *

    Backtrace:
    #0 (): spl_autoload_call(string inventoryclear\Main)
    #1 /src/pocketmine/plugin/FolderPluginLoader(48): class_exists(string inventoryclear\Main, boolean 1)
    #2 /src/pocketmine/plugin/PluginManager(155): pocketmine\plugin\FolderPluginLoader->loadPlugin(string /home/servs/srv3211/plugins/InventoryClear)
    #3 /src/pocketmine/plugin/PluginManager(299): pocketmine\plugin\PluginManager->loadPlugin(string /home/servs/srv3211/plugins/InventoryClear, array Array())
    #4 /src/pocketmine/Server(1886): pocketmine\plugin\PluginManager->loadPlugins(string /home/servs/srv3211/plugins/)
    #5 /src/pocketmine/PocketMine(456): pocketmine\Server->__construct(pocketmine\CompatibleClassLoader object, pocketmine\utils\MainLogger object, string phar:///home/servs/srv3211/PocketMine-MP.phar/, string /home/servs/srv3211/, string /home/servs/srv3211/plugins/)
    #6 (1): require_once(string phar:///home/servs/srv3211/PocketMine-MP.phar/src/pocketmine/PocketMine.php)

    Genisys version: 1.1dev #0 [Protocol 45; API 1.13.1]
    uname -a: Linux pe2.24serv.pro 3.10.0-327.4.5.el7.x86_64 #1 SMP Mon Jan 25 22:07:14 UTC 2016 x86_64
    PHP version: 5.6.2
    Zend version: 2.6.0
    OS : Linux, linux
  13. kwasmuth
    Offline

    kwasmuth New Member

    Joined:
    Feb 6, 2016
    Posts:
    12
    Minecraft User:
    elite041802
    Can you add a feature where you can set it to clear a players inventory on joining without having to edit the config?
  14. Hypozonic
    Offline

    Hypozonic New Member

    Joined:
    Apr 30, 2016
    Posts:
    7
    Minecraft User:
    Hypozonic
    Is it possible to set this up so it clears the inventory upom leaving creative mode/world and joining survival?

    I've got my server running a plots style creative world and survival world... But creative invent is transfer fearing thought the SignWarp.

    Would this is able to counteract that or even set up it as a TapToDo block, with teleport command?
  15. Jujulian100
    Offline

    Jujulian100 New Member

    Joined:
    Sep 14, 2016
    Posts:
    1
    Minecraft User:
    Jujulian100
    When ever I install it, it crashes my server :( I really need it for my server plz do something or am my. Issuing something?

Share This Page

Advertisement