Player can get Item from GUI-inventory with shift clicking

Discussion in 'Spigot Plugin Help' started by Fabian_Amundsen, Mar 9, 2021.

  1. setCancelled works until I use closeInvenotry; the item appeares after closing in the inventory of the player.

    Code:

    Code (Java):

    public void clickmenu(InventoryClickEvent e){
        if (e.getView().getTitle() == "Players")  {
            e.setCancelled(true);
            Player p = (Player) e.getWhoClicked();
            p.closeInventory();
     
     
  2. SteelPhoenix

    Moderator

    upload_2021-3-9_16-55-5.png

    Also, why are you comparing objects using == here?
     
  3. Ah ok thank you!

    So is there a better way to do it?


    thats because im noob