Need help with armor

Discussion in 'Plugin Development' started by Techno360!, Feb 9, 2019.

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

    Techno360!

    Does anyone know how to make a command that sets a player's armor to helmet, chestplate, leggings, and boots all of which have unbreakable (or unbreaking 10) on it? For some reason, I always get an error when I try to do this stuff.
     

    Attached Files:

  2. Offline

    timtower Administrator Administrator Moderator

    @Techno360! Hover your mouse over it, what does it say?
     
  3. Offline

    Evonoucono

    @Techno360! The array size you specified is 0, of course you can't add any elements to it. Here are other ways you can do this using a string array example:
    Code:
    String[] stringArray = new String[4];
    or
    Code:
    String[] stringArray = {"0", "1", "2", "3"};
     
  4. Offline

    Techno360!

    Okay so @timtower it says "Remove Argument to match ItemStack()" for all four of the errors.

    It's so weird because I checked examples on how to do it and nothing seems to work.

    It's so weird because I checked examples on how to do it and nothing seems to work.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Feb 9, 2019
  5. Offline

    timtower Administrator Administrator Moderator

  6. Offline

    KarimAKL

    @Techno360! Try changing this:
    Code:Java
    1. ItemStack[] armor = {};

    to this:
    Code:Java
    1. ItemStack[] armor = new ItemStack[4];
     
  7. Offline

    Techno360!

  8. Offline

    timtower Administrator Administrator Moderator

    @Techno360! Change the spigot.jar or craftbukkit.jar to the Bukkit.jar in your build path
    You imported the wrong ItemStack
     
    KarimAKL likes this.
  9. Offline

    Techno360!

    Thanks for your help guys!
     
Thread Status:
Not open for further replies.

Share This Page