@EventHandler(priority = EventPriority.LOWEST)
 public void onPermissionSystemEvent(PermissionSystemEvent event) {
   switch (event.getAction()) {
     case REINJECT_PERMISSIBLES:
     case RELOADED:
       uninjectAllPermissibles();
       injectAllPermissibles();
       break;
     default:
       return;
   }
 }
Esempio 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
      }
    }