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);
   }
 }
 @Override
 public void destroy() {
   PlayerMoveEvent.getHandlerList().unregister(this);
 }