Package xyz.tehbrian.restrictionhelper
Class RestrictionHelper
- java.lang.Object
-
- xyz.tehbrian.restrictionhelper.RestrictionHelper
-
public class RestrictionHelper extends java.lang.ObjectThe main class for use in interacting with RestrictionHelper.
-
-
Constructor Summary
Constructors Constructor Description RestrictionHelper(java.util.logging.Logger logger)Creates an instance of RestrictionHelper with a DebugLogger constructed withlogger.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckRestrictions(org.bukkit.entity.Player player, org.bukkit.Location loc, ActionType actionType)Checks whetherplayerhas sufficient permission to performactionatlocaccording to all registered restrictions.DebugLoggergetDebugLogger()Gets the DebugLogger constructed with the Logger provided toRestrictionHelper(Logger).java.util.List<Restriction>getRegisteredRestrictions()Gets the internal list of registered restrictions.voidregisterRestriction(Restriction restriction)Registers a restriction to be checked against.voidunregisterRestriction(Restriction restriction)Unregisters a restriction.
-
-
-
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 whetherplayerhas sufficient permission to performactionatlocaccording to all registered restrictions.- Parameters:
player- the playerloc- the location to checkedactionType- the type of action to check- Returns:
- true if the player has permission, false if not
-
getDebugLogger
public DebugLogger getDebugLogger()
Gets the DebugLogger constructed with the Logger provided toRestrictionHelper(Logger).- Returns:
- the debug logger
-
-