Ejemplo n.º 1
0
 @EventHandler(priority = EventPriority.LOWEST)
 public void onPermissionSystemEvent(PermissionSystemEvent event) {
   switch (event.getAction()) {
     case REINJECT_PERMISSIBLES:
     case RELOADED:
       uninjectAllPermissibles();
       injectAllPermissibles();
       break;
     default:
       return;
   }
 }
Ejemplo n.º 2
0
    @EventHandler(priority = EventPriority.HIGH)
    public void onPermissionSystemEvent(PermissionSystemEvent event) {

      try {
        if (PermissionEventEnums.PEXSystem_Action.valueOf(event.getEventName()) != null) {
          // Update all players.
          for (Player toUpdate : BukkitTools.getOnlinePlayers()) {
            if (toUpdate != null) {
              // setup default modes
              String[] modes =
                  getPlayerPermissionStringNode(
                          toUpdate.getName(), PermissionNodes.TOWNY_DEFAULT_MODES.getNode())
                      .split(",");
              plugin.setPlayerMode(toUpdate, modes, false);
              plugin.resetCache(toUpdate);
            }
          }
        }
      } catch (IllegalArgumentException e) {
        // Not tracking this event type
      }
    }