Plugin Help Plugin won't register commands as separate!!

Discussion in 'Plugin Help/Development/Requests' started by CheifKeef, Jul 27, 2015.

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


    So I'm making a plugin when you do /ms it gives u a stick with stuff on it, and when you do /im it gives u a iron ingot with stuff, well i go into game and do /ms and it gives me the iron ingot, and when i do /im it gives me another iron ingot.

    Heres my code

    package me.PokeMasterBrobee.MagicStick;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.logging.Logger;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.enchantments.Enchantment;
    import org.bukkit.entity.Player;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
    import org.bukkit.plugin.Plugin;
    import org.bukkit.plugin.PluginDescriptionFile;
    public class MagicStick extends JavaPlugin {
        public final Logger logger = Logger.getLogger("Minecraft");
        public static Plugin plugin;
        public void onDisable() {
            PluginDescriptionFile pdfFile = this.getDescription();
   + pdfFile.getVersion() + " has been disabled!");
        public void onEnable() {
            PluginDescriptionFile pdfFile = this.getDescription();
   + pdfFile.getVersion() + " has been enabled!");
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            Player player = (Player) sender;
            ItemStack magicstick = new ItemStack(Material.STICK);
            ItemMeta item = magicstick.getItemMeta();
            List<String> magicstickl = new ArrayList<String>();
            magicstickl.add(ChatColor.RED + "Use to fight off dangerous criters!");
            item.setDisplayName(ChatColor.GREEN + "MagicStick");
            magicstick.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 4);
            magicstick.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 4);
            ItemStack ironman = new ItemStack(Material.IRON_INGOT);
            ItemMeta ironitem = ironman.getItemMeta();
            List<String> ironiteml = new ArrayList<String>();
            ironiteml.add(ChatColor.RED + "Use this to activate potions!");
            ironitem.setDisplayName(ChatColor.AQUA + "IronMan");
            ironman.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 3);
            return false;
  2. Offline


    @CheifKeef if statements are inclosed with curly brackets (the new eclipse is weird and won't correct that error like it used to). Aside from that, you are clearly new to Java, before trying to code with Bukkit, you need to have a good grasp of Java or you will continue to run into simple mistakes as such. You can try looking at youtube videos, but I don't suggest, most will just feed you the code and not explain what it actually does. I suggest looking at some of the tutorials on Oracle.
    Last edited: Jul 29, 2015
Thread Status:
Not open for further replies.

Share This Page