private static Listener getRegisteredListener(Listener listener) {
   RegisteredListener[] registeredListeners =
       PlayerMoveEvent.getHandlerList().getRegisteredListeners();
   for (RegisteredListener registeredListener : registeredListeners) {
     if (registeredListener.getListener() == listener) {
       return listener;
     }
   }
   return null;
 }
 private static void unregisterMovementHandler() {
   Listener registeredListener = getRegisteredListener(movementListener);
   if (registeredListener != null) {
     PlayerMoveEvent.getHandlerList().unregister(registeredListener);
   }
 }
예제 #3
0
 @Override
 public void destroy() {
   PlayerMoveEvent.getHandlerList().unregister(this);
 }