Solved Armorstands HELP! :(

Discussion in 'Plugin Help/Development/Requests' started by GamingMeatheadHD, Feb 20, 2015.

Thread Status:
Not open for further replies.
  1. UPDATE: I found my own problem. I was passing a Player instead of a String to the armorStands map. I'll leave me code here though for anyone that might be looking for some help with Armor Stands! :)


    Hey there. So I'm making a 1:1 League of Legends plugin. When players select a "champ", an armor stand appears with their head, a few items from that champ, and the champ's name above the armorstand.

    Now, the code below was working perfectly earlier. Now, it's throwing a NullPointerException at "armorStands.get(player).setCustomName(PlayerInfo.getPI(player.getName()).getChamp());" I've checked to make sure that armorStands.get(player) isn't returning null and that PlayerInfo.getPI(player.getName()).getChamp() isn't returning null.

    armorStands is a map that stores the name of the player along with the armor stand that they spawn in. PlayerInfo.getPI(player.getName()).getChamp() is simply a string that represents the name of the champ the player chose. PlayerInfo is my own custom class where I keep player information and stats.

    Any ideas or thoughts? Here's the code:
    Player player = (Player) event.getWhoClicked();
            Location loc = player.getLocation();
            ArmorStand stand = player.getLocation().getWorld().spawn(loc, ArmorStand.class);
            armorStands.put(player.getName(), stand);
            ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short)SkullType.PLAYER.ordinal());
            SkullMeta meta = (SkullMeta) head.getItemMeta();
    Last edited: Feb 20, 2015
Thread Status:
Not open for further replies.

Share This Page