[SPIGOT-308] Custom Event IllegalPluginAccessException Created: 28/Dec/14  Updated: 02/Jan/15  Resolved: 02/Jan/15

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: john01dav Assignee: Unassigned
Resolution: Cannot Reproduce Votes: 0
Labels: 1.8, bug, spigot
Environment:

Ubuntu Desktop 14.04 x64 LTS, Oracle Java 8


Plugin: SQLPerms closed beta

 Description   

Hello Spigot! I am working on a recode to SQLPerms, and while doing so I came across an issue with the following class: http://pastebin.com/ebYwAWxP

As you can see, this is an event class. However, when I attempt to register a listener that listens for this event, I get the following error: http://pastebin.com/EhnDkXGK

As far as I can tell, based off this (http://wiki.bukkit.org/Event_API_Reference#Custom_Event_Example) and this (https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/event/world/ChunkLoadEvent.java), I did this correctly. I would appreciate any direction on what I may be doing wrong, or if this is a bug in Spigot.



 Comments   
Comment by Black Hole [ 28/Dec/14 ]

I think the cause is that you define the event in plugin A and use it in plugin B.
In plugin B you have to declare that it depends on plugin A in the plugin.yml file.

Comment by john01dav [ 28/Dec/14 ]

I do not understand it either, but it still happens. The exception occurs when I register a listener that listens for this custom event.

Comment by Antony Riley [ 28/Dec/14 ]

It works for me, I suspect you've messed up and the code you're testing isn't the code you think you're testing.

I don't see why with your code this:

https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/plugin/SimplePluginManager.java#l575

would not be able to find the static method for getHandlerList.

Comment by john01dav [ 28/Dec/14 ]

Also occurs ongit-Bukkit-850a9e0, but with a slightly different stack trace: http://paste.md-5.net/luquhilaqi.avrasm.

Comment by john01dav [ 28/Dec/14 ]

Just tested on git-Spigot-13716d9-850a9e0, confirmed bug still occurs.

Comment by john01dav [ 28/Dec/14 ]

cybertiger
I have that, see the class in the bug report.

Comment by Antony Riley [ 28/Dec/14 ]

Event classes require a static getHandlerList() method in order to work, this is a "feature" of the event system bukkit uses.

Example here: https://github.com/cybertiger/Bukkit-DuckChat/blob/master/duckchat-bukkit/src/main/java/org/cyberiantiger/minecraft/duckchat/bukkit/event/ChannelMessageEvent.java#L22-L24

Not a bug.

Comment by SpigotMC [ 28/Dec/14 ]

Your build is not the latest and therefor may be the reason you are having this issue. Spigot is 6 version(s) behind. CraftBukkit is 15 version(s) behind. This message was automatically generated and is not guaranteed to be a solution to your issue.

Generated at Mon Apr 21 21:19:18 UTC 2025 using Jira 10.3.5#10030005-sha1:190c783f2bd6c69cd5accdb70f97e48812a78d14.