Error with storing BukkitRunnable in HashMap

Discussion in 'Spigot Plugin Help' started by pixelatedtm, Jun 3, 2018.

  1. I am making a auction plugin and well i need to store the data of how long the auction is going on for.
    I store that data in 3 seperate HashMaps, Data itself for the Auctioned item, The BukkitRunnable data
    and the timer data. When i auction a item for the HashMap with the BukkitRunnable in to start i get a error.

    Error in hastebin:
    My code from the error:

    Error with the specific line:
    runTaskTimerAsynchronously(main.getInstance(), 20, 20));
  2. The stacktrace is showing line 123 in your Which line is it in your haste?
  3. Line 123 is Auctions.start(key, time); so it is reffering to the function in the Auctions file i sent
  4. Can you try to replace Auctions.start(key, time); with your method, to get further information about the error?
  5. The code:
    The error:
    The place where the error comes from: which is }.runTaskTimerAsynchronously(main.getInstance(), 20, 20));

    Also says caused by: Caused by: java.lang.IllegalArgumentException: Plugin cannot be null
  6. Try removing the .getInstance() from main.

    runTaskTimerAsynchronously(main, 20, 20));
  7. Cant it says Expression Expected
  8. Oh I see you are using static methods and fields.
    Is there a reason for that?

    Try calling the Auction class from main and pass the constructor the main class so you can access your main class just with "main".
  9. I'm going to be fair with you, i don't quite understand what you mean.
  10. Nvm pal i fixed it i forgot to do instance = this; in the on enable
    • Agree Agree x 1