1.8.8 Unable to find handler list for event org.bukkit.event.player.PlayerEvent

Discussion in 'Spigot Plugin Development' started by ProjectJeeb, Feb 17, 2020.

Thread Status:
Not open for further replies.
  1. Full Error:
    Code (Text):
    Unable to find handler list for event org.bukkit.event.player.PlayerEvent. Static getHandlerList method required!
    The error says that the problem is on line 24.

    I'm registering the listeners here.
    Code (Java):
    getServer().getPluginManager().registerEvents(new ArmorListener(), this);
    getServer().getPluginManager().registerEvents(this, this); // this is line 24
    Any help?
     
  2. Hi, can you show the full class and the full error? you are probably using an event that can't be registered (fe: PlayerBucketEvent)
     
  3. drives_a_ford

    Moderator

    • Agree Agree x 1
  4. md_5

    Administrator Developer

    You can't register PlayerEvent directly, only it's subclasses
     
  5. The event class extends to PlayerEvent.

    And then in the main class

    Code (Java):
    Bukkit.getPluginManager().callEvent((Event) ArmorEquipEvent);
    Bukkit.getPluginManager().registerEvents(new ArmorListener(), this);
    Seems to throw a null pointer though
     
  6. Could you show the stack trace of this exception?
     
  7. Code (Text):
    Error occurred while enabling CustomArmour v1.0-SNAPSHOT (Is it up to date?)
    java.lang.NullPointerException
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:477) ~[server.jar:git-Spigot-db6de12-18fbb24]
            at me.kxuy.customarmour.CustomArmour.onEnable(CustomArmour.java:29) ~[?:?]
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[server.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [server.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [server.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [server.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [server.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:414) [server.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:378) [server.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:333) [server.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:263) [server.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [server.jar:git-Spigot-db6de12-18fbb24]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_241]
    Line 29 in CustomArmour:
    Code (Java):
    Bukkit.getPluginManager().callEvent((Event) ArmorEquipEvent);
    Surrounding this is
    Code (Text):
    private Object ArmorEquipEvent;

    Bukkit.getPluginManager().callEvent((Event) ArmorEquipEvent);
    Bukkit.getPluginManager().registerEvents(new ArmorListener(), this);
     
  8. You need to initialize the `ArmorEquipEvent` field with a value.
     
  9. What, something like this?
    Code (Java):
    ArmorEquipEvent x = new ArmourEquipEvent();
     
  10. md_5

    Administrator Developer

    +this
     
  11. That's how you initialize a variable, yes.
     
Thread Status:
Not open for further replies.