Class LifestealerUserRulesController

java.lang.Object
dev.chicoferreira.lifestealer.user.rules.LifestealerUserRulesController

public class LifestealerUserRulesController extends Object
  • Constructor Details

  • Method Details

    • setDefaultRule

      public void setDefaultRule(LifestealerUserRules defaultRule)
      Sets the default rule that will be used when no group matches the permissions. Used when the configuration is reloaded.
      Parameters:
      defaultRule - the default rule to set
    • setGroupRules

      public void setGroupRules(List<LifestealerUserRulesGroup> groups)
      Sets the groups that will be used to calculate the rules based on the permissions. Used when the configuration is reloaded.
      Parameters:
      groups - the groups to set
    • computeRulesByPermission

      public LifestealerUserRules computeRulesByPermission(Function<String,Boolean> permissionTester)
      Calculates the LifestealerUserRules that the permissions tested indicates.

      If no group matches the permissions, the default cap is returned. If multiple groups match the permissions, the last one is returned, falling back to previous ones when it does not have a min or max hearts.

      This will only compute the rules based on the permissions. If you want to compute the rules based on the user and the permissions, use LifestealerUserController.computeUserRules(Player, LifestealerUser) as it will also take into account the user's rules modifiers.

      Parameters:
      permissionTester - a function that tests if something has a permission (e.g.
      player::hasPermission
      )
      Returns:
      the LifestealerUserRules that the permissions tested indicates