Clear Inventory (AND ARMOR)

Discussion in 'Archived: Plugin Requests' started by Cjbolt, Sep 21, 2012.

  1. Offline

    Cjbolt

    Hello there, after messing with essentials, I realized to my dismay that their clear inventory doesn't clear armor slots. I thought I found a plugin that would work, but sadly, it doesn't.

    Could someone out there make a plugin that clears inventory and armor slots, and the default permissions is that a player can only clear his own inventory?

    Thanks,
    couljj
     
  2. Offline

    Kodfod

  3. Offline

    Cjbolt

    That's the plugin I was referring to. I have essentials and the two aren't compatible because they use the same command.
     
  4. Offline

    Necrodoom

    you do know bci overrides essentials /ci command, yes?
     
  5. Offline

    Cjbolt

    Is there any reason that the command refuses to work properly then? I type the command, and literally nothing happens. No error, at all. Not even an error in the console. It makes me think that the plugin isn't even on the server...
     
  6. Offline

    Necrodoom

    error with the plugin it self, possibly, the plugin is made by an essentials IRC helper, and was tested in bukkit + essentials server.
    paste startup log.
     
  7. Offline

    Cjbolt

    Code:
    22.09 17:36:59 [Server] Startup Done (4.143s)! For help, type "help" or "?"
    22.09 17:36:59 [Server] INFO Server permissions file permissions.yml is empty, ignoring it
    22.09 17:36:59 [Server] INFO [AntiCheat] Enabling AntiCheat v1.3.6
    22.09 17:36:59 [Server] INFO [EssentialsChat] Enabling EssentialsChat v2.9.3
    22.09 17:36:59 [Server] INFO [PEXRank] Found PermissionsEx and ready to enable
    22.09 17:36:59 [Server] INFO [PEXRank] Enabling PEXRank v1.3.1
    22.09 17:36:59 [Server] INFO [EssentialsSpawn] Enabling EssentialsSpawn v2.9.3
    22.09 17:36:58 [Server] INFO Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
    22.09 17:36:58 [Multicraft] Skipped 12 lines due to rate limit (30/s)
    22.09 17:36:58 [Server] INFO [WorldGuard] Loaded configuration for world 'world'
    22.09 17:36:58 [Server] INFO [WorldGuard] (world) Fire spread is UNRESTRICTED.
    22.09 17:36:58 [Server] INFO [WorldGuard] (world) Lava fire is blocked.
    22.09 17:36:58 [Server] INFO [WorldGuard] (world) Lighters are PERMITTED.
    22.09 17:36:58 [Server] INFO [WorldGuard] (world) TNT ignition is PERMITTED.
    22.09 17:36:58 [Server] INFO [WorldGuard] Enabling WorldGuard v5.5.3
    22.09 17:36:58 [Server] INFO [BetterClearInventory] **BetterClearInventory version 0.1 Beta has been enabled.**
    22.09 17:36:58 [Server] INFO [BetterClearInventory] Enabling BetterClearInventory v0.1 Beta
    22.09 17:36:58 [Server] INFO [MobBountyReloaded] build 282 enabled.
    22.09 17:36:58 [Server] INFO [MobBountyReloaded] WorldGuard hooked.
    22.09 17:36:58 [Server] INFO [MobBountyReloaded] mcMMO hooked.
    22.09 17:36:58 [Server] INFO [MobBountyReloaded] Enabling MobBountyReloaded v282
    22.09 17:36:58 [Server] INFO [InstaTNT] Enabling InstaTNT v0.1
    22.09 17:36:58 [Server] INFO [CombatTag] has loaded with a tag time of 10 seconds
    22.09 17:36:58 [Server] INFO [CombatTag] Enabling CombatTag v5.0
    22.09 17:36:58 [Server] INFO [Commander] Enabled
    22.09 17:36:58 [Server] INFO [Commander] Successfully imported 1 patterns from consolecmd.txt
    22.09 17:36:58 [Server] INFO [Commander] Successfully imported 6 patterns from playerchat.txt
    22.09 17:36:58 [Server] INFO [Commander] Successfully imported 7 patterns from playercmd.txt
    22.09 17:36:58 [Server] INFO [Commander] Enabling Commander v1.2.3
    22.09 17:36:58 [Server] INFO [Vault][Chat] PermissionsEx_Chat hooked.
    22.09 17:36:58 [Server] INFO [Vault][Permission] PermissionsEx hooked.
    22.09 17:36:58 [Server] INFO WEPIF: PermissionsEx detected! Using PermissionsEx for permissions.
    22.09 17:36:58 [Server] INFO [PermissionsEx] v1.19.3 enabled
    22.09 17:36:58 [Server] INFO [PermissionsEx] Superperms support enabled.
    22.09 17:36:58 [Server] INFO [PermissionsEx] Enabling PermissionsEx v1.19.3
    22.09 17:36:58 [Server] INFO [Buycraft] Plugin has been successfully enabled.
    22.09 17:36:58 [Server] INFO [Buycraft] Loaded 2 package(s) into the cache.
    22.09 17:36:57 [Server] INFO [Buycraft] Enabling Buycraft v4.7
    22.09 17:36:57 [Server] INFO [MultiCommand] is enabled!
    22.09 17:36:57 [Server] INFO [MultiCommand] You are running the lastest release: 2.0
    22.09 17:36:56 [Server] INFO [MultiCommand] Using Vault!
    22.09 17:36:56 [Server] INFO [MultiCommand] Enabling MultiCommand v2.0
    22.09 17:36:56 [Server] INFO WEPIF: Using the Bukkit Permissions API.
    22.09 17:36:56 [Server] INFO [WorldEdit] Enabling WorldEdit v5.4.2
    22.09 17:36:56 [Server] INFO [ReadingRainbow] Enabling ReadingRainbow v0.1
    22.09 17:36:56 [Server] INFO [NoDrops] Enabling NoDrops v0.3
    22.09 17:36:56 [Server] INFO Preparing start region for level 1 (Seed: 3130890901445129214)
    22.09 17:36:56 [Multicraft] Skipped 8 lines due to rate limit (30/s)
    22.09 17:36:55 [Server] INFO [Vault][Chat] PermissionsEx found: Waiting
    22.09 17:36:55 [Server] INFO [Vault][Permission] SuperPermissions loaded as backup permission system.
    22.09 17:36:55 [Server] INFO [Vault][Permission] PermissionsEx found: Waiting
    22.09 17:36:55 [Server] INFO [Vault][Economy] Essentials Economy found: Waiting
    22.09 17:36:55 [Server] INFO [Vault] Enabling Vault v1.2.18-b229
    22.09 17:36:55 [Server] INFO [AntiCheat] Loading AntiCheat v1.3.6
    22.09 17:36:55 [Server] INFO [EssentialsChat] Loading EssentialsChat v2.9.3
    22.09 17:36:55 [Server] INFO [PEXRank] Loading PEXRank v1.3.1
    22.09 17:36:55 [Server] INFO [EssentialsSpawn] Loading EssentialsSpawn v2.9.3
    22.09 17:36:55 [Server] INFO MLog clients using java 1.4+ standard logging.
    22.09 17:36:55 [Server] INFO [EssentialsProtect] Loading EssentialsProtect v2.9.3
    22.09 17:36:55 [Server] INFO [Essentials] Loading Essentials v2.9.3
    22.09 17:36:55 [Server] INFO [WorldGuard] Loading WorldGuard v5.5.3
    22.09 17:36:55 [Server] INFO [mcMMO] Loading mcMMO v1.3.11-b1030
    22.09 17:36:55 [Server] INFO [BetterClearInventory] Loading BetterClearInventory v0.1 Beta
    22.09 17:36:55 [Server] INFO [MobBountyReloaded] Loading MobBountyReloaded v282
    22.09 17:36:55 [Server] INFO [InstaTNT] Loading InstaTNT v0.1
    22.09 17:36:55 [Server] INFO [CombatTag] Loading CombatTag v5.0
    22.09 17:36:55 [Server] INFO [Commander] Loading Commander v1.2.3
    22.09 17:36:55 [Server] INFO [PermissionsEx] Initializing file backend
    22.09 17:36:55 [Server] INFO [PermissionsEx] Loading PermissionsEx v1.19.3
    22.09 17:36:55 [Server] INFO [Vault] Loading Vault v1.2.18-b229
    22.09 17:36:55 [Server] INFO [Buycraft] Loading Buycraft v4.7
    22.09 17:36:55 [Server] INFO [MultiCommand] Loading MultiCommand v2.0
    22.09 17:36:55 [Server] INFO [WorldEdit] Loading WorldEdit v5.4.2
    22.09 17:36:55 [Server] INFO [ReadingRainbow] Loading ReadingRainbow v0.1
    22.09 17:36:55 [Server] INFO [NoDrops] Loading NoDrops v0.3
    22.09 17:36:55 [Server] INFO [PermissionsEx] PermissionEx plugin initialized.
    22.09 17:36:55 [Server] INFO [PermissionsEx] file backend registered!
    22.09 17:36:55 [Server] INFO [PermissionsEx] sql backend registered!
    22.09 17:36:54 [Server] INFO This server is running CraftBukkit version git-Bukkit-1.3.1-R2.0-b2340jnks (MC: 1.3.1) (Implementing API version 1.3.1-R2.0)
    22.09 17:36:54 [Server] INFO Starting Minecraft server on 216.244.86.226:25570
    22.09 17:36:54 [Server] INFO Generating keypair
    22.09 17:36:54 [Server] INFO Default game type: SURVIVAL
    22.09 17:36:54 [Server] INFO Loading properties
    22.09 17:36:54 [Server] INFO Starting minecraft server version 1.3.1
    22.09 17:36:53 [Server] INFO 27 achievements
    22.09 17:36:53 [Server] INFO 195 recipes
    22.09 17:36:53 [Multicraft] Loaded config for "Mod: Craftbukkit"
    22.09 17:36:53 [Multicraft] Starting Minecraft!
    22.09 17:36:53 [Multicraft] Loading Minecraft instance properties
    22.09 17:36:52 [Multicraft] Received start command
    Just the log for BetterInventory
    Code:
    22.09 17:36:58 [Server] INFO [BetterClearInventory] **BetterClearInventory version 0.1 Beta has been enabled.**
    22.09 17:36:58 [Server] INFO [BetterClearInventory] Enabling BetterClearInventory v0.1 Beta
    /ci : Works but does not clear armor
    /ci -f : Doesn't work, doesn't register an error in the console or client.
     
  8. Offline

    Necrodoom

    hm, for a test, try open the essentials.jar with zip application, open plugin.yml, go to clearinventory command part, remove ci alias (make sure to not damage the file) if this works, il contact aaomidi.
     
  9. Offline

    Woobie

    This is literally like 10 lines of code, or less (+ imports and other stuff ofc)
    If no one does this once i wake up, ill do it.
    What do you want the command to be?
     
  10. Offline

    PogoStick29

    I'll have it done in 10 minutes.
     
  11. Offline

    -_Husky_-

    It's been 13 mins.. :p
     
  12. Offline

    PogoStick29

    Right now, it's clearing the inventory, just not the armor. Tell me what I'm doing wrong:

    Code:
    package me.pogostick29.betterclearinventory;
     
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Main extends JavaPlugin {
     
        public boolean onCommand (CommandSender sender, Command cmd, String commandLabel, String[] args) {
           
            if (!(sender instanceof Player)) { sender.sendMessage(ChatColor.RED + "The console doesn't have an inventory!"); return true; }
           
            Player p = (Player) sender;
           
            if (cmd.getName().equalsIgnoreCase("bci")) {
                p.getInventory().clear();
                p.getInventory().setHelmet(new ItemStack (Material.AIR));
                p.getInventory().setChestplate(new ItemStack (Material.AIR));
                p.getInventory().setLeggings(new ItemStack (Material.AIR));
                p.getInventory().setBoots(new ItemStack (Material.AIR));
                p.sendMessage(ChatColor.GREEN + "Your inventory has been cleared!");
            }
            return true;
        }
    }
     
  13. Offline

    -_Husky_-

    Try setting it null (probably wont make a difference, worth a try)
     
  14. Offline

    np98765

    You're correct; it's supposed to be null. :)
     
  15. Offline

    -_Husky_-

    What a guess! Not too experienced with inventories, apart from mucking with chests
     
  16. Offline

    PogoStick29

    Trying that now...
    EDIT:
    -_Husky_- and np98765
    Nope, here's my code:

    Code:
    package me.pogostick29.betterclearinventory;
     
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Main extends JavaPlugin {
     
        public boolean onCommand (CommandSender sender, Command cmd, String commandLabel, String[] args) {
         
            if (!(sender instanceof Player)) { sender.sendMessage(ChatColor.RED + "The console doesn't have an inventory!"); return true; }
         
            Player p = (Player) sender;
         
            if (cmd.getName().equalsIgnoreCase("bci")) {
                p.getInventory().clear();
                p.getInventory().setHelmet(null);
                p.getInventory().setChestplate(null);
                p.getInventory().setLeggings(null);
                p.getInventory().setBoots(null);
                p.sendMessage(ChatColor.GREEN + "Your inventory has been cleared!");
            }
            return true;
        }
    }
     
  17. Offline

    Cjbolt

    Anything besides /ci or /clearinventory
    Thanks!
     
  18. Offline

    np98765

    PogoStick29
    Let me give this a try. If it doesn't work within the first 10 minutes, I'll stop. :3
     
  19. Offline

    NinjaW0lf

    Just a ProTip
    If ur gonna be clearing the entire armor contents to one thing, use:
    setArmorContents instead of individually setting each piece. less code :p
     
  20. Offline

    np98765

    Finished -- You can download it <Edit by Moderator: Redacted mediafire url>

    Any issues or feature requests, just shoot me a PM. :)
     
    Last edited by a moderator: Nov 9, 2016
  21. Offline

    Cjbolt

    [quote uid=17954 name="np98765" post=1346244]Finished -- You can download it <Edit by Moderator: Redacted mediafire url>

    Any issues or feature requests, just shoot me a PM. :)[/quote]
    Thanks a lot, I'll be testing it out soon. What's the command though, that clears the inventory? Might be useful(;
     
    Last edited by a moderator: Nov 9, 2016
  22. Offline

    Kodfod

    For future reference, you can always right click the jarfile, open with an archive manager (like 7-ZIP or Win-rar) and look at the plugin.yml for all the commands, permission nodes, usages, descriptions, etc
     
  23. Offline

    np98765

    Who needs to know the command?? :p

    The command is /cleareverything, but you can use /ce or even /clearall.
     
    Kodfod likes this.
  24. Offline

    Cjbolt

    Very useful. Appreciate all you've done for me. xD

    Thanks, aha

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
    Kodfod likes this.
  25. Offline

    PogoStick29

    [quote uid=17954 name="np98765" post=1346244]Finished -- You can download it <Edit by Moderator: Redacted mediafire url>

    Any issues or feature requests, just shoot me a PM. :)[/quote]
    Permission to decompile :p
     
    Last edited by a moderator: Nov 9, 2016
  26. Offline

    np98765

    Feel free. I would post the 30-ish (i think) line source, but I'm not at my computer. :p
     
  27. Offline

    PogoStick29

    I looked at it and I don't see what I did wrong... Hmm...
     
  28. Offline

    Woobie

    Is it not working?
    This is like 5 lines of actual code, and imports etc.
     
  29. Offline

    PogoStick29

    This code I wrote only clears the inventory, not armor:

    Code:
    package me.pogostick29.betterclearinventory;
     
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Main extends JavaPlugin {
     
        public boolean onCommand (CommandSender sender, Command cmd, String commandLabel, String[] args) {
       
            if (!(sender instanceof Player)) { sender.sendMessage(ChatColor.RED + "The console doesn't have an inventory!"); return true; }
       
            Player p = (Player) sender;
       
            if (cmd.getName().equalsIgnoreCase("bci")) {
                p.getInventory().clear();
                p.getInventory().setHelmet(null);
                p.getInventory().setChestplate(null);
                p.getInventory().setLeggings(null);
                p.getInventory().setBoots(null);
                p.sendMessage(ChatColor.GREEN + "Your inventory has been cleared!");
            }
            return true;
        }
    }
     
  30. Offline

    Woobie

    Try setHelmet(AIR);
    setBoots(AIR);
    Etc...
     

Share This Page