Open ham1255 opened 4 weeks ago
It's probably a good idea to stop using an interface whose methods need to be implemented in the listener class. This practice should not be used.
It's probably a good idea to stop using an interface whose methods need to be implemented in the listener class. This practice should not be used.
is there reason not to use this practice?
It's probably a good idea to stop using an interface whose methods need to be implemented in the listener class. This practice should not be used.
is there reason not to use this practice?
This violates the design principle of event listeners. Velocity doesn't have any listener interfaces like they do BungeeCord/Bukkit. In Velocity any object can be a listener. I advise you to simply register listeners on each platform individually. If you need some custom events, then make them separate for each platform and force users use specific APIs for each platform. This will be the easiest way.
The problem
Since if i want multi platform support i tend to create API not to be depend on proxy that used which I create
ITestEvent.java
andITestListener.java
which then i implement in itproxy api
which can be seen in steps to reproduce.what i should expect that event to be handled single time but instead it fired 2 times, well this was weird so i checked if i didn't double register the listener or something, and it wasn't so i kept debugging until i reached idea it could be velocity problem, so after debugging with velocity, so IN
VelocityEventManager
atregisterInternally
aftercollectMethods
i inserted this debug codeafter adding debug messages i could see 2 methods registered
doSomething(net.limework.test.ITestEvent)
shouldn't be registered since it does not have@Subscribe
steps to reproduce
public interface ITestEvent {
}
public interface ITestListener {
}
register TestListener.java
fire the event TestEvent.java with example Code used to trigger the event
see the console output