Solved Trying to make A workstation

Discussion in 'Spigot Plugin Development' started by MoonNetwork, Jun 13, 2021.

  1. Hi guys I am trying to make a workstation(like mmoitems). Players will make a item from there. If player have enough item to craft that item the npc will take the item from player and put in to a queue. And after a couple minutes(like 30 minutes or 1 hour) npc will send a title to player like "your order is done, come and take it". And if player click to the item again item will be sended to players inventory. I made the gui part and I can detect if player click to item. And I can give a item. But I couldnt made the product time can you guys help please? I tried to make it with a hashmap but It didnt work. Whats wrong? This is the full line code. The give part is starts at line 164.

    Code :
  2. I dunno what's wrong with that line exactly but if you're going to ask me it might give you Null Exception since display name of an item is nullable. You're getting the displayname without checking if it is null or not. And also read why method is deprecated don't just suppress it just a tip.
  3. But I am checking it with this code line:

    Code (Text):

    if (clicked != null && clicked.hasItemMeta()
                    && clicked.getItemMeta().getDisplayName().equalsIgnoreCase("&a&lİşle &fGantarit Miğfer")))
  4. Yeah you are checking if the item meta is null not the displayname u can check it by getItemMeta.hasDisplayName()

    getItemMeta#getDisplayName returns to a String of item displayname which can be null, so you need to check it if it's null or not. Smth like getItemMeta#hasDisplayName() or getItemMeta().getDisplayName() != null
    #5 Lifeonblack, Jun 13, 2021
    Last edited: Jun 13, 2021
    • Winner Winner x 1
  5. Thats worked. Thank you so much sir.