Example #1
0
 final boolean register(Class<S> event) {
   if (this.registered) {
     return false;
   } else {
     this.registered = true;
     Sponge.getEventManager()
         .registerListener(
             Pore.getPlugin(), event, EventPriorityConverter.of(this.priority), this);
     return true;
   }
 }
Example #2
0
    @Override
    public void register(EventPriority priority) {
      PoreEventHandler<S> listener = listeners.get(priority);
      if (listener == null) {
        if (constructor == null) {
          this.constructor = PoreConstructors.create(pore, sponge);
        }

        listener = new PoreEventHandler<>(priority, constructor);
        listeners.put(priority, listener);
      }

      Pore.getGame()
          .getEventManager()
          .registerListener(
              Pore.getPlugin(), sponge, EventPriorityConverter.of(priority), listener);
    }