Plugin Request [Simple] Slot Delete

Discussion in 'Plugin Help/Development/Requests' started by PhillyCheezsteak, Apr 2, 2016.

Thread Status:
Not open for further replies.
  1. Plugin Name: Slot Delete
    Permission: slotdelete.admin
    Command: slotdelete (item slot number)

    Description: Deletes the item in the player's inventory slot without displaying any messages.

    that is basically it.
     
  2. Offline

    minecrft

    Hello,

    I am taking on this challenge and will probably be done by tonight.

    Regards, Jake B.
     
  3. Offline

    minecrft

    Code:
    package me.bukkit.minecrft;
    
    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.permissions.Permission;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class SlotDelete extends JavaPlugin{
       
        public Permission playerPermission = new Permission("slotdelete.admin");
    
        @Override
        public void onEnable() {
        PluginManager pm = getServer().getPluginManager();
        pm.addPermission(playerPermission);
       
        }
    
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
           
                    if (cmd.getName().equalsIgnoreCase("slotdelete") && sender instanceof Player) {
                        Player player = (Player) sender;
                        int length = args.length;
                        if (player.hasPermission("slotdelete.admin")) {
                         if (length == 1) {
                                if (args[0].equals("1")) {
                                    player.getInventory().setItem(0,new ItemStack(Material.AIR));;
                                }
                                if (args[0].equals("2")) {
                                    player.getInventory().setItem(1,new ItemStack(Material.AIR));;
                                }
                                if (args[0].equals("3")) {
                                    player.getInventory().setItem(2,new ItemStack(Material.AIR));;
                                }
                                if (args[0].equals("4")) {
                                    player.getInventory().setItem(3,new ItemStack(Material.AIR));;
                                }
                                if (args[0].equals("5")) {
                                    player.getInventory().setItem(4,new ItemStack(Material.AIR));;
                                }
                                if (args[0].equals("6")) {
                                    player.getInventory().setItem(5,new ItemStack(Material.AIR));;
                                }
                                if (args[0].equals("7")) {
                                    player.getInventory().setItem(6,new ItemStack(Material.AIR));;
                                }
                                if (args[0].equals("8")) {
                                    player.getInventory().setItem(7,new ItemStack(Material.AIR));;
                                   
                                }
                                if (args[0].equals("9")) {
                                    player.getInventory().setItem(8 ,new ItemStack(Material.AIR));;
                                }
                        }
                           
                                return true;
                           
                }
                    }
                   
               
               
            return true;
        }
    
        @Override
        public void onDisable() {
           
        }
       
    }
    
    Hello,

    I finished this plugin a very long time ago but due to bukkit being annoying on creating "plugin" forums, I could not do that, so i'll just give you the code directly
    Regards, Jake B.
     
  4. Offline

    timtower Moderator Moderator

    Could you explain more on that?
     
Thread Status:
Not open for further replies.

Share This Page