diff --git a/src/fr/neatmonster/nocheatplus/event/IHaveMethodOrder.java b/src/fr/neatmonster/nocheatplus/event/IHaveMethodOrder.java new file mode 100644 index 00000000..65b28f35 --- /dev/null +++ b/src/fr/neatmonster/nocheatplus/event/IHaveMethodOrder.java @@ -0,0 +1,16 @@ +package fr.neatmonster.nocheatplus.event; + +import fr.neatmonster.nocheatplus.event.GenericListener.MethodEntry.MethodOrder; + +/** + * Implement to register Listeners via delegation that does not allow for passinf MethodOrder directly. + * @author mc_dev + * + */ +public interface IHaveMethodOrder { + /** + * + * @return + */ + public MethodOrder getMethodOrder(); +} diff --git a/src/fr/neatmonster/nocheatplus/event/ListenerManager.java b/src/fr/neatmonster/nocheatplus/event/ListenerManager.java index 7101b836..1b9759a5 100644 --- a/src/fr/neatmonster/nocheatplus/event/ListenerManager.java +++ b/src/fr/neatmonster/nocheatplus/event/ListenerManager.java @@ -109,6 +109,9 @@ public class ListenerManager { * @param order Allows to register before other tags or just first. Expect MethodOrder to change in near future. The method order of already registered methods will not be compared to. */ public void registerAllEventHandlers(Listener listener, String tag, MethodOrder order){ + if (order == null && listener instanceof IHaveMethodOrder){ + order = ((IHaveMethodOrder) listener).getMethodOrder(); + } Class clazz = listener.getClass(); Set allMethods = new HashSet(); for (Method method : clazz.getMethods()){