Interface Permissions
public interface Permissions
A simple permissions API.
-
Method Summary
Modifier and TypeMethodDescriptionstatic CompletableFuture<Boolean> Performs a permission check, falling back tofalseif the resultant state isTriState.DEFAULT.static CompletableFuture<Boolean> check(@NotNull com.mojang.authlib.GameProfile profile, @NotNull String permission, boolean defaultValue) Performs a permission check, falling back tofalseif the resultant state isTriState.DEFAULT.static CompletableFuture<Boolean> check(@NotNull com.mojang.authlib.GameProfile profile, @NotNull String permission, int defaultRequiredLevel, @NotNull net.minecraft.server.MinecraftServer server) Deprecated.static CompletableFuture<Boolean> check(@NotNull com.mojang.authlib.GameProfile profile, @NotNull String permission, @NotNull net.minecraft.server.permissions.PermissionLevel defaultRequiredLevel, @NotNull net.minecraft.server.MinecraftServer server) Performs a permission check, falling back to requiring thedefaultRequiredLevelif the resultant state isTriState.DEFAULT.static CompletableFuture<Boolean> Performs a permission check, falling back tofalseif the resultant state isTriState.DEFAULT.static CompletableFuture<Boolean> Performs a permission check, falling back to thedefaultValueif the resultant state isTriState.DEFAULT.static booleanPerforms a permission check, falling back tofalseif the resultant state isTriState.DEFAULT.static booleancheck(@NotNull net.minecraft.commands.SharedSuggestionProvider source, @NotNull String permission, boolean defaultValue) Performs a permission check, falling back to thedefaultValueif the resultant state isTriState.DEFAULT.static booleancheck(@NotNull net.minecraft.commands.SharedSuggestionProvider source, @NotNull String permission, int defaultRequiredLevel) Deprecated.static booleancheck(@NotNull net.minecraft.commands.SharedSuggestionProvider source, @NotNull String permission, @NotNull net.minecraft.server.permissions.PermissionLevel defaultRequiredLevel) Performs a permission check, falling back to requiring thedefaultRequiredLevelif the resultant state isTriState.DEFAULT.static CompletableFuture<Boolean> Performs a permission check, falling back tofalseif the resultant state isTriState.DEFAULT.static CompletableFuture<Boolean> check(@NotNull net.minecraft.server.players.NameAndId entry, @NotNull String permission, boolean defaultValue) Performs a permission check, falling back tofalseif the resultant state isTriState.DEFAULT.static CompletableFuture<Boolean> check(@NotNull net.minecraft.server.players.NameAndId entry, @NotNull String permission, int defaultRequiredLevel, @NotNull net.minecraft.server.MinecraftServer server) Deprecated.static CompletableFuture<Boolean> check(@NotNull net.minecraft.server.players.NameAndId entry, @NotNull String permission, net.minecraft.server.permissions.PermissionLevel defaultRequiredLevel, @NotNull net.minecraft.server.MinecraftServer server) Performs a permission check, falling back to requiring thedefaultRequiredLevelif the resultant state isTriState.DEFAULT.static booleanPerforms a permission check, falling back tofalseif the resultant state isTriState.DEFAULT.static booleancheck(@NotNull net.minecraft.world.entity.Entity entity, @NotNull String permission, boolean defaultValue) Performs a permission check, falling back to thedefaultValueif the resultant state isTriState.DEFAULT.static booleancheck(@NotNull net.minecraft.world.entity.Entity entity, @NotNull String permission, int defaultRequiredLevel) Deprecated.usecheck(Entity, String, PermissionLevel)insteadstatic booleancheck(@NotNull net.minecraft.world.entity.Entity entity, @NotNull String permission, net.minecraft.server.permissions.PermissionLevel defaultRequiredLevel) Performs a permission check, falling back to requiring thedefaultRequiredLevelif the resultant state isTriState.DEFAULT.static @NotNull CompletableFuture<net.fabricmc.fabric.api.util.TriState> getPermissionValue(@NotNull UUID uuid, @NotNull String permission) Gets thestateof apermissionfor the given (potentially) offline player.static @NotNull net.fabricmc.fabric.api.util.TriStategetPermissionValue(@NotNull net.minecraft.commands.SharedSuggestionProvider source, @NotNull String permission) Gets thestateof apermissionfor the given source.static @NotNull net.fabricmc.fabric.api.util.TriStategetPermissionValue(@NotNull net.minecraft.world.entity.Entity entity, @NotNull String permission) Gets thestateof apermissionfor the given entity.static @NotNull Predicate<net.minecraft.commands.CommandSourceStack> Creates a predicate which returns the result of performing a permission check, falling back tofalseif the resultant state isTriState.DEFAULT.static @NotNull Predicate<net.minecraft.commands.CommandSourceStack> Creates a predicate which returns the result of performing a permission check, falling back to thedefaultValueif the resultant state isTriState.DEFAULT.static @NotNull Predicate<net.minecraft.commands.CommandSourceStack> Deprecated.userequire(String, PermissionLevel)insteadstatic @NotNull Predicate<net.minecraft.commands.CommandSourceStack> require(@NotNull String permission, net.minecraft.server.permissions.PermissionLevel defaultRequiredLevel) Creates a predicate which returns the result of performing a permission check, falling back to requiring thedefaultRequiredLevelif the resultant state isTriState.DEFAULT.
-
Method Details
-
require
@NotNull static @NotNull Predicate<net.minecraft.commands.CommandSourceStack> require(@NotNull @NotNull String permission, boolean defaultValue) Creates a predicate which returns the result of performing a permission check, falling back to thedefaultValueif the resultant state isTriState.DEFAULT.- Parameters:
permission- the permission to checkdefaultValue- the default value to use if nothing has been set- Returns:
- a predicate that will perform the permission check
-
require
@Deprecated @NotNull static @NotNull Predicate<net.minecraft.commands.CommandSourceStack> require(@NotNull @NotNull String permission, int defaultRequiredLevel) Deprecated.userequire(String, PermissionLevel)insteadCreates a predicate which returns the result of performing a permission check, falling back to requiring thedefaultRequiredLevelif the resultant state isTriState.DEFAULT.- Parameters:
permission- the permission to checkdefaultRequiredLevel- the required permission level to check for as a fallback- Returns:
- a predicate that will perform the permission check
-
require
@NotNull static @NotNull Predicate<net.minecraft.commands.CommandSourceStack> require(@NotNull @NotNull String permission, net.minecraft.server.permissions.PermissionLevel defaultRequiredLevel) Creates a predicate which returns the result of performing a permission check, falling back to requiring thedefaultRequiredLevelif the resultant state isTriState.DEFAULT.- Parameters:
permission- the permission to checkdefaultRequiredLevel- the required permission level to check for as a fallback- Returns:
- a predicate that will perform the permission check
-
require
@NotNull static @NotNull Predicate<net.minecraft.commands.CommandSourceStack> require(@NotNull @NotNull String permission) Creates a predicate which returns the result of performing a permission check, falling back tofalseif the resultant state isTriState.DEFAULT.- Parameters:
permission- the permission to check- Returns:
- a predicate that will perform the permission check
-
getPermissionValue
@NotNull static @NotNull net.fabricmc.fabric.api.util.TriState getPermissionValue(@NotNull @NotNull net.minecraft.world.entity.Entity entity, @NotNull @NotNull String permission) Gets thestateof apermissionfor the given entity.- Parameters:
entity- the entitypermission- the permission- Returns:
- the state of the permission
-
check
static boolean check(@NotNull @NotNull net.minecraft.world.entity.Entity entity, @NotNull @NotNull String permission, boolean defaultValue) Performs a permission check, falling back to thedefaultValueif the resultant state isTriState.DEFAULT.- Parameters:
entity- the entity to perform the check forpermission- the permission to checkdefaultValue- the default value to use if nothing has been set- Returns:
- the result of the permission check
-
check
@Deprecated static boolean check(@NotNull @NotNull net.minecraft.world.entity.Entity entity, @NotNull @NotNull String permission, int defaultRequiredLevel) Deprecated.usecheck(Entity, String, PermissionLevel)insteadPerforms a permission check, falling back to requiring thedefaultRequiredLevelif the resultant state isTriState.DEFAULT.- Parameters:
entity- the entity to perform the check forpermission- the permission to checkdefaultRequiredLevel- the required permission level to check for as a fallback- Returns:
- the result of the permission check
-
check
static boolean check(@NotNull @NotNull net.minecraft.world.entity.Entity entity, @NotNull @NotNull String permission, net.minecraft.server.permissions.PermissionLevel defaultRequiredLevel) Performs a permission check, falling back to requiring thedefaultRequiredLevelif the resultant state isTriState.DEFAULT.- Parameters:
entity- the entity to perform the check forpermission- the permission to checkdefaultRequiredLevel- the required permission level to check for as a fallback- Returns:
- the result of the permission check
-
check
static boolean check(@NotNull @NotNull net.minecraft.world.entity.Entity entity, @NotNull @NotNull String permission) Performs a permission check, falling back tofalseif the resultant state isTriState.DEFAULT.- Parameters:
entity- the entity to perform the check forpermission- the permission to check- Returns:
- the result of the permission check
-
getPermissionValue
@NotNull static @NotNull CompletableFuture<net.fabricmc.fabric.api.util.TriState> getPermissionValue(@NotNull @NotNull UUID uuid, @NotNull @NotNull String permission) Gets thestateof apermissionfor the given (potentially) offline player.- Parameters:
uuid- the uuid of the playerpermission- the permission- Returns:
- the state of the permission
-
check
static CompletableFuture<Boolean> check(@NotNull @NotNull UUID uuid, @NotNull @NotNull String permission, boolean defaultValue) Performs a permission check, falling back to thedefaultValueif the resultant state isTriState.DEFAULT.- Parameters:
uuid- the uuid of the player to perform the check forpermission- the permission to checkdefaultValue- the default value to use if nothing has been set- Returns:
- the result of the permission check
-
check
static CompletableFuture<Boolean> check(@NotNull @NotNull UUID uuid, @NotNull @NotNull String permission) Performs a permission check, falling back tofalseif the resultant state isTriState.DEFAULT.- Parameters:
uuid- the uuid of the player to perform the check forpermission- the permission to check- Returns:
- the result of the permission check
-
check
static CompletableFuture<Boolean> check(@NotNull @NotNull com.mojang.authlib.GameProfile profile, @NotNull @NotNull String permission, boolean defaultValue) Performs a permission check, falling back tofalseif the resultant state isTriState.DEFAULT.- Parameters:
profile- the player profile to perform the check forpermission- the permission to checkdefaultValue- the default value to use if nothing has been set- Returns:
- the result of the permission check
-
check
static CompletableFuture<Boolean> check(@NotNull @NotNull com.mojang.authlib.GameProfile profile, @NotNull @NotNull String permission) Performs a permission check, falling back tofalseif the resultant state isTriState.DEFAULT.- Parameters:
profile- the player profile to perform the check forpermission- the permission to check- Returns:
- the result of the permission check
-
check
@Deprecated static CompletableFuture<Boolean> check(@NotNull @NotNull com.mojang.authlib.GameProfile profile, @NotNull @NotNull String permission, int defaultRequiredLevel, @NotNull @NotNull net.minecraft.server.MinecraftServer server) Deprecated.Performs a permission check, falling back to requiring thedefaultRequiredLevelif the resultant state isTriState.DEFAULT.- Parameters:
profile- the player profile to perform the check forpermission- the permission to checkdefaultRequiredLevel- the required permission level to check for as a fallbackserver- instance to check permission level- Returns:
- the result of the permission check
-
check
static CompletableFuture<Boolean> check(@NotNull @NotNull com.mojang.authlib.GameProfile profile, @NotNull @NotNull String permission, @NotNull @NotNull net.minecraft.server.permissions.PermissionLevel defaultRequiredLevel, @NotNull @NotNull net.minecraft.server.MinecraftServer server) Performs a permission check, falling back to requiring thedefaultRequiredLevelif the resultant state isTriState.DEFAULT.- Parameters:
profile- the player profile to perform the check forpermission- the permission to checkdefaultRequiredLevel- the required permission level to check for as a fallbackserver- instance to check permission level- Returns:
- the result of the permission check
-
check
static CompletableFuture<Boolean> check(@NotNull @NotNull net.minecraft.server.players.NameAndId entry, @NotNull @NotNull String permission, boolean defaultValue) Performs a permission check, falling back tofalseif the resultant state isTriState.DEFAULT.- Parameters:
entry- the player config entry to perform the check forpermission- the permission to checkdefaultValue- the default value to use if nothing has been set- Returns:
- the result of the permission check
-
check
static CompletableFuture<Boolean> check(@NotNull @NotNull net.minecraft.server.players.NameAndId entry, @NotNull @NotNull String permission) Performs a permission check, falling back tofalseif the resultant state isTriState.DEFAULT.- Parameters:
entry- the player config entry to perform the check forpermission- the permission to check- Returns:
- the result of the permission check
-
check
@Deprecated static CompletableFuture<Boolean> check(@NotNull @NotNull net.minecraft.server.players.NameAndId entry, @NotNull @NotNull String permission, int defaultRequiredLevel, @NotNull @NotNull net.minecraft.server.MinecraftServer server) Deprecated.Performs a permission check, falling back to requiring thedefaultRequiredLevelif the resultant state isTriState.DEFAULT.- Parameters:
entry- the player config entry to perform the check forpermission- the permission to checkdefaultRequiredLevel- the required permission level to check for as a fallbackserver- instance to check permission level- Returns:
- the result of the permission check
-
check
static CompletableFuture<Boolean> check(@NotNull @NotNull net.minecraft.server.players.NameAndId entry, @NotNull @NotNull String permission, net.minecraft.server.permissions.PermissionLevel defaultRequiredLevel, @NotNull @NotNull net.minecraft.server.MinecraftServer server) Performs a permission check, falling back to requiring thedefaultRequiredLevelif the resultant state isTriState.DEFAULT.- Parameters:
entry- the player config entry to perform the check forpermission- the permission to checkdefaultRequiredLevel- the required permission level to check for as a fallbackserver- instance to check permission level- Returns:
- the result of the permission check
check(GameProfile, String, PermissionLevel, MinecraftServer)instead