Spigot 1.16 InventoryClickListener

Discussion in 'Plugin Development' started by MiBB3L, Feb 12, 2021.

  1. Offline

    MiBB3L

    I have a problem with my InventoryClickListener it works fine, but everytime a Player swaps an Item in his inventory its printing an error code. To fix that I made this if-statement but it seems to not work


    Code:
    if(event.getView().getType().equals(player.getInventory().getType())) {
                  return;
              }
    I worked with 1.8 Spigot before, so I donĀ“t know if there are any other solutions in the 1.16 Spigot for my problem.

    @timtower help me please

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Feb 12, 2021
  2. Offline

    Kars

    Show the error and the code.
    @MiBB3L
     
  3. Offline

    MiBB3L

  4. Offline

    Strahan

    It'd have been better had you not cropped the file; now we have no way of correlating the HB line numbers to the real line numbers to know what line is 39. Which is it?
     
  5. Offline

    MiBB3L

    listener(39) = hastebin(19)


    String name = item.getItemMeta().getDisplayName();
     
  6. Offline

    Kars

    @MiBB3L itemMeta of the item is null. Replace hasItemMeta with getItemMeta == null in your checks.
     

Share This Page