Discussion in 'Plugin Development' started by NeverRevenge, Sep 17, 2015.

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



    So I just started developing plugins and i cant figure out how to open a GUI
    when someone rightclicks a beacon or any kind of block!

    It is probably a realy simple thing i missed.
    So, if someone could tell me how i can do this that would be great!!

    NeverRevenge <3
  2. Offline


    Wich kind of gui?

    You can listen to PlayerInteractEvent and check the type of the block.
        public void onPlayerInteract(PlayerInteractEvent e) {
            Player p = e.getPlayer();
            if (e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getClickedBlock().getType() == Material.BEACON) {
                // OPEN THE GUI
    The code above checks if the player right clicked a block and then if it was a beacon.
  3. Offline


    @pedrinholuizf, eh, idk if that's what she meant.

    First, create an inventory using Bukkit.createIventory(String name and probably some other stuff I forget...)
    Then to open that inventory, do Player#openInventory(Inventory inv);
    From there on you can use the InventoryClickEvent to make it interactive.
Thread Status:
Not open for further replies.

Share This Page