mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-14 22:56:18 +01:00
Fix handlers order when registering one with after.
I am not sure exactly if this is the source of the problem, but when i tried registering my handlers using ExitFlag.FACTORY as "after" like how the javadocs said it, it seemed that my handler was running before the ExitFlag handler which means mine will run even if ExitFlag returns false. I used null as after and it worked then. Maybe i understand the "after" incorrectly but in my mind my customHandler should run after the "after" not the other way around if that makes sense. Let me know if I didn't undertstand it correctly. Sorry for my english!
This commit is contained in:
parent
8efc2e6539
commit
88854592ce
@ -128,7 +128,7 @@ public boolean registerHandler(Handler.Factory<? extends Handler> factory, @Null
|
||||
int index = handlers.indexOf(wrappedAfter != null ? wrappedAfter : after);
|
||||
if (index == -1) return false;
|
||||
|
||||
handlers.add(index, factory); // shifts "after" right one, and everything after "after" right one
|
||||
handlers.add(index + 1, factory); // shifts "after" right one, and everything after "after" right one
|
||||
}
|
||||
wrappedHandlers.put(factory, wrappedFactory);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user