Package de.Keyle.MyPet.api.player
Class Permissions
java.lang.Object
de.Keyle.MyPet.api.player.Permissions
Static permission-check utility. All MyPet permission queries go through
this class rather than calling
player.hasPermission() directly,
because MyPet supports an "extended permissions" mode
(MyPetGlobal.Permissions.EXTENDED) that gates optional features
behind additional permission nodes.
Two families of checks:
has()— unconditional check. Returnstrueif the player is OP or has the node.hasExtended()— conditional check. Only evaluates the node when extended-permissions mode is enabled; otherwise returnstrue(or the supplied default). This lets admins run MyPet with minimal permission setup when extended mode is off.
-
Constructor Summary
ConstructorsConstructorDescriptionNot intended for instantiation -- every member of this class is static. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanhas(MyPetPlayer player, String node) Checks a permission node against a MyPetPlayer.static booleanChecks a permission node against an online player.static booleanhas(OfflinePlayer player, String node) Offline permission check.static booleanhasExtended(MyPetPlayer player, String node) Extended-mode check for a MyPetPlayer.static booleanhasExtended(Player player, String node) Extended-mode check.static booleanhasExtended(Player player, String node, boolean defaultValue) Extended-mode check with an explicit default.static booleanhasExtended(OfflinePlayer player, String node) Extended-mode offline check.static booleanhasExtended(OfflinePlayer player, String node, boolean defaultValue) Extended-mode offline check with explicit default.
-
Constructor Details
-
Permissions
public Permissions()Not intended for instantiation -- every member of this class is static.
-
-
Method Details
-
has
Checks a permission node against a MyPetPlayer. Returnsfalseif the player is null or offline.- Parameters:
player- the player to testnode- the permission node to check- Returns:
trueif the player holds the node
-
has
Checks a permission node against an online player. OP always passes.- Parameters:
player- the player to testnode- the permission node to check- Returns:
trueif the player holds the node
-
hasExtended
Extended-mode check for a MyPetPlayer. When extended permissions are disabled globally, returnstruewithout checking the node.- Parameters:
player- the player to testnode- the permission node to check- Returns:
trueif the player holds the node, or extended permissions are off
-
hasExtended
Extended-mode check. Returnstrueif extended permissions are disabled, or if the player has the node.- Parameters:
player- the player to testnode- the permission node to check- Returns:
trueif the player holds the node, or extended permissions are off
-
hasExtended
Extended-mode check with an explicit default. When extended permissions are disabled, returnsdefaultValueinstead of unconditionally passing.- Parameters:
player- the player to testnode- the permission node to checkdefaultValue- what to return when extended permissions are switched off- Returns:
trueif the player holds the node, otherwisedefaultValuewhen extended permissions are off
-
has
Offline permission check. Constructs a temporaryPermissibleBaseto evaluate the node without an active session. OP always passes.- Parameters:
player- the player to testnode- the permission node to check- Returns:
trueif the player holds the node
-
hasExtended
Extended-mode offline check. SeehasExtended(Player, String).- Parameters:
player- the player to testnode- the permission node to check- Returns:
trueif the player holds the node, or extended permissions are off
-
hasExtended
Extended-mode offline check with explicit default.- Parameters:
player- the player to testnode- the permission node to checkdefaultValue- what to return when extended permissions are switched off- Returns:
trueif the player holds the node, otherwisedefaultValuewhen extended permissions are off
-