Interface Permissions
public interface Permissions
A simple permissions API.
-
Method Summary
Static MethodsModifier 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) 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.command.CommandSource source, @NotNull String permission, boolean defaultValue) Performs a permission check, falling back to thedefaultValueif the resultant state isTriState.DEFAULT.static booleancheck(@NotNull net.minecraft.command.CommandSource source, @NotNull String permission, int defaultRequiredLevel) 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.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.entity.Entity entity, @NotNull String permission, int 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.command.CommandSource source, @NotNull String permission) Gets thestateof apermissionfor the given source.static @NotNull net.fabricmc.fabric.api.util.TriStategetPermissionValue(@NotNull net.minecraft.entity.Entity entity, @NotNull String permission) Gets thestateof apermissionfor the given entity.static @NotNull Predicate<net.minecraft.server.command.ServerCommandSource>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.server.command.ServerCommandSource>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.server.command.ServerCommandSource>Creates a predicate which returns the result of performing a permission check, falling back to requiring thedefaultRequiredLevelif the resultant state isTriState.DEFAULT.
-
Method Details
-
getPermissionValue
@NotNull static @NotNull net.fabricmc.fabric.api.util.TriState getPermissionValue(@NotNull @NotNull net.minecraft.command.CommandSource source, @NotNull @NotNull String permission) Gets thestateof apermissionfor the given source.- Parameters:
source- the sourcepermission- the permission- Returns:
- the state of the permission
-
check
static boolean check(@NotNull @NotNull net.minecraft.command.CommandSource source, @NotNull @NotNull String permission, boolean defaultValue) Performs a permission check, falling back to thedefaultValueif the resultant state isTriState.DEFAULT.- Parameters:
source- the source 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 boolean check(@NotNull @NotNull net.minecraft.command.CommandSource source, @NotNull @NotNull String permission, int defaultRequiredLevel) Performs a permission check, falling back to requiring thedefaultRequiredLevelif the resultant state isTriState.DEFAULT.- Parameters:
source- the source 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.command.CommandSource source, @NotNull @NotNull String permission) Performs a permission check, falling back tofalseif the resultant state isTriState.DEFAULT.- Parameters:
source- the source to perform the check forpermission- the permission to check- Returns:
- the result of the permission check
-
require
@NotNull static @NotNull Predicate<net.minecraft.server.command.ServerCommandSource> 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
@NotNull static @NotNull Predicate<net.minecraft.server.command.ServerCommandSource> require(@NotNull @NotNull String permission, int 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.server.command.ServerCommandSource> 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.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.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
static boolean check(@NotNull @NotNull net.minecraft.entity.Entity entity, @NotNull @NotNull String permission, int 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.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
static CompletableFuture<Boolean> check(@NotNull @NotNull com.mojang.authlib.GameProfile profile, @NotNull @NotNull String permission, int 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
-