How to change item's names?

Discussion in 'Plugin Development' started by MineCrypt, Dec 24, 2012.

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

    MineCrypt

    Can someone please explain to me how you would change the name of an item with the new bukkit versions? I had it working before but now my code does not seem to work, so how can you do it now?
     
  2. Offline

    drampelt

    I think this should work, if it doesn't just tell me
    Code:
    public ItemStack setName(ItemStack is, String name){
            ItemMeta m = is.getItemMeta();
            m.setDisplayName(name);
            is.setItemMeta(m);
            return is;
        }
     
    Ahmet094 likes this.
  3. Offline

    repsor

    I always use the NBTTagCompund but since the new update that gives errors: this is the new way?
     
  4. Offline

    drampelt

    I am fairly certain this is the "proper" way to do it. Editing NBTTagCompounds should still work, but I think this is easier.
     
  5. Offline

    Empty2k12

    Jes to add a Lore do this:
    Code:java
    1.  
    2. ArrayList<String> lore = new ArrayList<String>();
    3. lore.add("JavaNoob!");
    4. meta.setLore(lore);
    5.  
     
  6. Offline

    ferrybig

    yes, since some 1.4.5 updated, al craftbukkit and nms classes have chance package names, they are doing it on every update, because most people dont follow the actual rules and use craftbukkit instead of bukkit to compile their plugin, and not addng same guards for incase the methode they relaying on have chanced name, like first there was a methode that spawns a sheep, but later it may be a methode that spawns the enderdragon after an update, whitout the plugin delevoper known it, just because "Their code compiles", so the users are going to wine to the plugin creator, and he is going to whine back to bukkit, and they to him for his foulish methode

    see the following thread for more information how they are doing the stuff whit the package names:
    http://forums.bukkit.org/threads/sa...cked-and-potentially-damaging-plugins.116749/
     
  7. Offline

    EnvisionRed

    The bukkit ItemMeta is actually a wrapper for NBTTagCompounds, and will not be corrupted by updates. I only use CraftBukkit or NMS when it's completely necessary, which sadly happens more than I would like it to.
     
  8. Offline

    MineCrypt

    Alright well doing the above thing didnt seem to work :/ maybe Im adding it wrong? Or something? Idk
     
  9. Offline

    fireblast709

    What is your current code?
     
Thread Status:
Not open for further replies.

Share This Page