[Unsolved] ArrayList getting Players inside it.....

Discussion in 'Plugin Development' started by ASHninja1997, Oct 1, 2013.

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


    i am trying to figure out how to give the players inside the array-list their items I have two different Arraylists one called Attackers and one Call Defenders. Look in the code below for more information on what i am trying to accomplish. Thanks :D
    1. if(Defend.contains(po.getName())){
    2. Player Defending = (Player) Defend.iterator();
    3. po.teleport(new Location(Bukkit.getWorld("world"), -100.5, 70.5, 241.5));
    4. ItemStack bow = new ItemStack(Material.BOW);
    5. Defending.getInventory().addItem(new ItemStack(bow));
    6. } else {
    7. Player Attacking = (Player) Attack.iterator();
    8. po.teleport(new Location(Bukkit.getWorld("world"), -215.5, 64.5, 205.5));
    9. ItemStack Pick2 = new ItemStack(Material.STONE_PICKAXE);
    10. Pick2.addEnchantment(Enchantment.DIG_SPEED, 1);
    11. Attacking.getInventory().addItem(new ItemStack(Pick2));
    12. }
  2. Offline


    First of all, you may want to look into some java tutorials(especially with those variable names).
    Second, what is po? What are you even doing? Calling .iterator() returns a new iterator made from the list, so you can't cast that to a player. Read javadocs, watch tutorials, and you'll know what you're doing wrong, but if you want help, we're going to need more of your code and whatever errors you're getting.
Thread Status:
Not open for further replies.

Share This Page