GUI Problems - e.getSlot() not working

Discussion in 'Plugin Development' started by Circlestorm, Feb 8, 2021.

  1. Offline


    Hello, i am making a rank setter command in spigot.
    The ranks are stored in a ranks.yml file, and the way they are set is with a command /setrank <player>
    The plugin checks if the player has admin or owner rank in the ranks.yml, or if the player is Circlestorm (me) as i own the server.

    It then opens a GUI, and creates the inventory inside of the command; there are 7 inventories, and i know there are more efficient ways, but when you click on the first GUI, it opens up a confirm/deny GUI, and because there are 6 ranks to add, there are 6 confirm/deny GUIs. The event InventoryClickEvent fires as tested, but the event.getSlot method do not work; do i have to define the inventory in the onEnable method?

    Thank you
  2. Offline


    You can define the inventory when a player opens the inventory, and use e.getRawSlot() which would return an integer.

Share This Page