Class RestrictionHelper


  • public class RestrictionHelper
    extends java.lang.Object
    The main class for use in interacting with RestrictionHelper.
    • Constructor Detail

      • RestrictionHelper

        public RestrictionHelper​(java.util.logging.Logger logger)
        Creates an instance of RestrictionHelper with a DebugLogger constructed with logger.
        Parameters:
        logger - your plugin's logger, use JavaPlugin.getLogger() to get
    • Method Detail

      • registerRestriction

        public void registerRestriction​(Restriction restriction)
        Registers a restriction to be checked against.

        NOTE: Since RestrictionHelper is a shade-in dependency, other plugins will not be able to check against restrictions your plugin registers.

        Parameters:
        restriction - the restriction to register
      • unregisterRestriction

        public void unregisterRestriction​(Restriction restriction)
        Unregisters a restriction.

        NOTE: Since RestrictionHelper is a shade-in dependency, other plugins will not be affected by the restrictions your plugin unregisters.

        Parameters:
        restriction - the restriction to unregister
      • getRegisteredRestrictions

        public java.util.List<Restriction> getRegisteredRestrictions()
        Gets the internal list of registered restrictions.

        NOTE: Since RestrictionHelper is a shade-in dependency, this list is not shared with other plugins.

        Returns:
        the list of registered restrictions
      • checkRestrictions

        public boolean checkRestrictions​(org.bukkit.entity.Player player,
                                         org.bukkit.Location loc,
                                         ActionType actionType)
        Checks whether player has sufficient permission to perform action at loc according to all registered restrictions.
        Parameters:
        player - the player
        loc - the location to checked
        actionType - the type of action to check
        Returns:
        true if the player has permission, false if not