[HELP] Custom names with custom crafting.

Discussion in 'Plugin Development' started by Dippoakabob, Dec 4, 2012.

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

    Dippoakabob

    Hello,
    I am trying to make a plugin that requires a named Item, I know how to name items (thanks to another forum thread) but, unfortunately, I cannot figure out how to make my plugin name items when they are crafted.

    This is what I got so far:
    Code:
    //this is called in the onEnable class
        public void molotov(){
            //Making the ItemStack
            ItemStack molotov = new ItemStack(Material.POTION, 1, (short) 16384);
            //setting the name
            molotov = Namer.setName(molotov, "Molotov Cocktail");
            //adding the lore
            molotov = Namer.addLore(molotov, ChatColor.GREEN + "+" + ChatColor.RED + " EXPLOSIONS");
            //making the recipe
            ShapelessRecipe Molotov = new ShapelessRecipe(molotov).addIngredient(Material.BLAZE_POWDER).addIngredient(Material.GLASS_BOTTLE).addIngredient(Material.SULPHUR);
            getServer().addRecipe(Molotov);
        }
        
    What happens when I use this code (along with the "Namer" class) is that the Item just crafts a splash Mundane potion. No custom name.

    The link to the "Namer" class is http://forums.bukkit.org/threads/item-name-changing-class.104249/#post-1365796

    NOTE: The Item naming works fine if you add the ItemStack directly to a player's inventory.

    EDIT: I've seen posts in this forum similar to this, but none of them worked. at lease not for me. Please help, thanks
     
  2. Offline

    gomeow

    You could use an event, upon craft, rename it
     
Thread Status:
Not open for further replies.

Share This Page