HELP!

Discussion in 'Spigot Plugin Development' started by danielm175, Apr 20, 2017.

Thread Status:
Not open for further replies.
  1. Hi,

    I dont understand why this wont open the GUI for.
    I want it to open on block or air for testing . But i dont understand why it wont open.


    Code here:


    Code (Text):
    package me.join.com;


    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.inventory.Inventory;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
    import org.bukkit.plugin.java.JavaPlugin;


    public class Main extends JavaPlugin implements Listener {
        public void onEnable() {  
        getLogger().info(ChatColor.BLUE + "GUI TESTER");

        }

       
        @EventHandler
       
        public void onInt(PlayerInteractEvent e) {

        if(e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR) {
           
            //new
            ItemStack heald = new ItemStack(Material.POTION);
            ItemMeta meta = heald.getItemMeta();
            meta.setDisplayName(ChatColor.AQUA + "Testers");
            heald.setItemMeta(meta);
           
            //new
            ItemStack feed = new ItemStack(Material.FEATHER);
            ItemMeta feedmeta = feed.getItemMeta();
            feedmeta.setDisplayName(ChatColor.AQUA + "FeedMeta");
            feed.setItemMeta(feedmeta);
           
            Inventory inv = Bukkit.createInventory(null, 27, ChatColor.GREEN + "Heal And Feed");
           
            inv.setItem(2, heald);
           
            inv.setItem(6, feed);
           
            e.getPlayer().openInventory(inv);
           
           
           
           
           
        }
           
           
        }
       
       
       
       
    }
     
  2. Register the listener. Bukkit.getPluginManager().registerEvents(JavaPlugin, Listener); I think it was.
     
  3. I have fogot does it go under


    public class Main extends JavaPlugin implements Listener {



    or does it go under:


    public void onEnable() {



    ????
     

  4. Comes up a error the JavaPlugin and Listerner does
     
  5. Fix it thank you
     
Thread Status:
Not open for further replies.