Not work code..why?

Discussion in 'Spigot Plugin Development' started by dreadfaly, Aug 27, 2017.

Thread Status:
Not open for further replies.
  1. Why does not this code work?
     
    #1 dreadfaly, Aug 27, 2017
    Last edited: Aug 27, 2017
    • Creative Creative x 1
  2. you're referencing a static field from a void method
     
  3. What is the error?
     
  4. What do you expect it to do? What doesn't it do? Does it give you any errors? Please give us more information.

    EDIT: It looks like you didn't use the EventHandler annotation (@EventHandler).
     
  5. Code (Text):
    if (!realtimehash.containsKey(String.valueOf(p)));
    You're closing multiple if statements, essentially leaving them with empty bodies.
     
    • Agree Agree x 1
  6. No.
    Perhaps because of this nothing works. I'll try now.
     
  7. [​IMG]
     
  8. You have to put the EventHandler annotation above your onJoin method, not your TempChange method. Your TempChange method isn't a valid event method.
     
  9. Class TempChange does not work at all. How can this be remedied?
     
  10. I came here for help, not for advice.
     
  11. Please don't post screenshots, post the actual errors. Read what the error is. If you can't fix it, post the code.
     
  12. There are no errors. The code generally refuses to work.
     
  13. Show us your main class.
     
  14. The screenshot you posted contains a line which says "ERROR" after the date.
     
  15. Code (Text):
    public void onEnable() {
            Bukkit.getServer().getPluginManager().registerEvents(new Temp(), this);
        }
     
  16. It's because I added an inscription to the top (@EventHandler)
     
  17. Put @EventHandler above public void onJoin(PlayerJoinEvent event)
     
    • Agree Agree x 1
  18. The EventHandler annotation does not belong to your TempChange() method, it does to your onJoin method.
     
Thread Status:
Not open for further replies.