Kit plugin issue

Discussion in 'Bukkit Help' started by looparound, Jun 22, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    looparound

    Im a new coder and im trying to code a simple kit pvp for a ktis server. Now on a kits server once u have chosen a kit and try to choose another it may say "You allready have a kit". So I am trying to code that in my plugin and this is what i am putting,


    public class Main extends JavaPlugin {

    List<String> usedkit = new ArrayList<String>();

    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent event){
    Player p = event.getEntity().getPlayer();
    usedkit.remove(p.getName());
    }



    public boolean onCommand(CommandSender sender, Command cmd, String commandlabel, String[] args) {

    if (!(sender instanceof Player )) {
    sender.sendMessage(ChatColor.DARK_RED + "You may not use this in the Consle");

    }

    Player p = (Player)sender;

    if (cmd.getName().equalsIgnoreCase("kit pvp")){

    }
    if (usedkit.contains(p.getName())){
    p.sendMessage("You Have Already have a Kit.");
    }else{
    if(p.hasPermission("Kitpvp.pvp")){

    p.sendMessage(ChatColor.DARK_PURPLE + "[" + ChatColor.BLUE + "EverythingPvP" + ChatColor.DARK_PURPLE + "]" +ChatColor.DARK_RED + " You have Chosen The Kit PvP");

    for(int i = 0; i < 32; i++){

    PlayerInventory pi = (p.getInventory());

    removePotions(p);
    p.setExp(0.0F);
    p.setLevel(0);
    pi.clear();
    pi.setHelmet(null);
    pi.setChestplate(null);
    pi.setLeggings(null);
    pi.setBoots(null);

    ItemStack dsword = new ItemStack(Material.DIAMOND_SWORD, 1);



    pi.setChestplate(new ItemStack(Material.IRON_CHESTPLATE, 1));

    pi.setBoots(new ItemStack(Material.IRON_BOOTS, 1));

    pi.setHelmet(new ItemStack(Material.IRON_HELMET, 1));

    pi.setLeggings(new ItemStack(Material.IRON_LEGGINGS, 1));



    dsword.addEnchantment(Enchantment.DAMAGE_ALL, 1);


    pi.addItem(dsword);

    giveSoup(p, 32);






    }
    }


    }
    return true;
    }

    private void giveSoup(Player p, int i) {
    // TODO Auto-generated method stub

    }



    private void removePotions(Player p) {
    // TODO Auto-generated method stub

    }

    }

    And Whenever in game I allready have chosen the kit and try choosing it agian it doesnt give me the error msg. So if you know how to fix this plz tell me. Thanks :D
     
  2. Offline

    Necrodoom

    you never add to usedkits.
     
  3. Offline

    looparound

    What do you mean?
     
Thread Status:
Not open for further replies.

Share This Page