Solved Please explain this to me.. why won't this work?

Discussion in 'Plugin Development' started by Liam Allan, Aug 10, 2013.

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

    Liam Allan

    Everything is working but the custom recipes, would someone mind explaining why?

    Code:
    public void onDisable() {
            System.out.println("[MW] Plugin disabled.");
            Bukkit.clearRecipes();
        }
     
        public void onEnable() {
            System.out.println("[MW] Plugin enabled.");
            this.getServer().getPluginManager().registerEvents(this, this);
            if (!new File(getDataFolder(), "config.yml").exists()) {
                saveDefaultConfig();
            }
     
            ShapelessRecipe exploder = new ShapelessRecipe(getCustomItem(Items.Wand1));
            exploder.addIngredient(Material.TNT);
            exploder.addIngredient(Material.STICK);
            exploder.addIngredient(Material.IRON_INGOT);
            Bukkit.addRecipe(exploder);
     
            ShapelessRecipe lightning = new ShapelessRecipe(getCustomItem(Items.Wand2));
            lightning.addIngredient(Material.MOSSY_COBBLESTONE);
            lightning.addIngredient(Material.STICK);
            lightning.addIngredient(Material.IRON_INGOT);
            Bukkit.addRecipe(lightning);
        }
     
        public enum Items {
            Wand1, Wand2, Wand3;
        }
     
        public ItemStack getCustomItem(Items item) {
            ItemStack is = null;
            ItemMeta im;
            ArrayList<String> lore;
            switch (item) {
            case Wand1:
                is = new ItemStack(Material.STICK, 1);
                im = is.getItemMeta();
                im.setDisplayName(ChatColor.GOLD + "Wand Exploder");
                lore = new ArrayList<String>();
                lore.add(ChatColor.RED + "Creates a small explosion.");
                lore.add(ChatColor.RED + "Radius: 10");
                im.setLore(lore);
                is.setItemMeta(im);
                break;
            case Wand2:
                is = new ItemStack(Material.STICK, 1);
                im = is.getItemMeta();
                im.setDisplayName(ChatColor.GOLD + "Wand Lightning");
                lore = new ArrayList<String>();
                lore.add(ChatColor.RED + "Creates a lightning strike where clicked.");
                lore.add(ChatColor.RED + "Radius: 7");
                im.setLore(lore);
                is.setItemMeta(im);
                break;
            }
            return is;
        }
    Thanks in advanced.
     
  2. Offline

    PropGamer

    I think your missing
    ItemStack getResult()
     
  3. Offline

    Liam Allan

    This is not the problem.
     
  4. Offline

    PropGamer

  5. Offline

    Liam Allan

Thread Status:
Not open for further replies.

Share This Page