Interface Permissions


public interface Permissions
A simple permissions API.
  • Method Summary

    Modifier and Type
    Method
    Description
    check(@NotNull com.mojang.authlib.GameProfile profile, @NotNull String permission)
    Performs a permission check, falling back to false if the resultant state is TriState.DEFAULT.
    check(@NotNull com.mojang.authlib.GameProfile profile, @NotNull String permission, boolean defaultValue)
    Performs a permission check, falling back to false if the resultant state is TriState.DEFAULT.
    check(@NotNull com.mojang.authlib.GameProfile profile, @NotNull String permission, int defaultRequiredLevel, @NotNull net.minecraft.server.MinecraftServer server)
    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 the defaultRequiredLevel if the resultant state is TriState.DEFAULT.
    check(@NotNull UUID uuid, @NotNull String permission)
    Performs a permission check, falling back to false if the resultant state is TriState.DEFAULT.
    check(@NotNull UUID uuid, @NotNull String permission, boolean defaultValue)
    Performs a permission check, falling back to the defaultValue if the resultant state is TriState.DEFAULT.
    static boolean
    check(@NotNull net.minecraft.commands.SharedSuggestionProvider source, @NotNull String permission)
    Performs a permission check, falling back to false if the resultant state is TriState.DEFAULT.
    static boolean
    check(@NotNull net.minecraft.commands.SharedSuggestionProvider source, @NotNull String permission, boolean defaultValue)
    Performs a permission check, falling back to the defaultValue if the resultant state is TriState.DEFAULT.
    static boolean
    check(@NotNull net.minecraft.commands.SharedSuggestionProvider source, @NotNull String permission, int defaultRequiredLevel)
    static boolean
    check(@NotNull net.minecraft.commands.SharedSuggestionProvider source, @NotNull String permission, @NotNull net.minecraft.server.permissions.PermissionLevel defaultRequiredLevel)
    Performs a permission check, falling back to requiring the defaultRequiredLevel if the resultant state is TriState.DEFAULT.
    check(@NotNull net.minecraft.server.players.NameAndId entry, @NotNull String permission)
    Performs a permission check, falling back to false if the resultant state is TriState.DEFAULT.
    check(@NotNull net.minecraft.server.players.NameAndId entry, @NotNull String permission, boolean defaultValue)
    Performs a permission check, falling back to false if the resultant state is TriState.DEFAULT.
    check(@NotNull net.minecraft.server.players.NameAndId entry, @NotNull String permission, int defaultRequiredLevel, @NotNull net.minecraft.server.MinecraftServer server)
    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 the defaultRequiredLevel if the resultant state is TriState.DEFAULT.
    static boolean
    check(@NotNull net.minecraft.world.entity.Entity entity, @NotNull String permission)
    Performs a permission check, falling back to false if the resultant state is TriState.DEFAULT.
    static boolean
    check(@NotNull net.minecraft.world.entity.Entity entity, @NotNull String permission, boolean defaultValue)
    Performs a permission check, falling back to the defaultValue if the resultant state is TriState.DEFAULT.
    static boolean
    check(@NotNull net.minecraft.world.entity.Entity entity, @NotNull String permission, int defaultRequiredLevel)
    static boolean
    check(@NotNull net.minecraft.world.entity.Entity entity, @NotNull String permission, net.minecraft.server.permissions.PermissionLevel defaultRequiredLevel)
    Performs a permission check, falling back to requiring the defaultRequiredLevel if the resultant state is TriState.DEFAULT.
    static @NotNull CompletableFuture<net.fabricmc.fabric.api.util.TriState>
    getPermissionValue(@NotNull UUID uuid, @NotNull String permission)
    Gets the state of a permission for the given (potentially) offline player.
    static @NotNull net.fabricmc.fabric.api.util.TriState
    getPermissionValue(@NotNull net.minecraft.commands.SharedSuggestionProvider source, @NotNull String permission)
    Gets the state of a permission for the given source.
    static @NotNull net.fabricmc.fabric.api.util.TriState
    getPermissionValue(@NotNull net.minecraft.world.entity.Entity entity, @NotNull String permission)
    Gets the state of a permission for the given entity.
    static @NotNull Predicate<net.minecraft.commands.CommandSourceStack>
    require(@NotNull String permission)
    Creates a predicate which returns the result of performing a permission check, falling back to false if the resultant state is TriState.DEFAULT.
    static @NotNull Predicate<net.minecraft.commands.CommandSourceStack>
    require(@NotNull String permission, boolean defaultValue)
    Creates a predicate which returns the result of performing a permission check, falling back to the defaultValue if the resultant state is TriState.DEFAULT.
    static @NotNull Predicate<net.minecraft.commands.CommandSourceStack>
    require(@NotNull String permission, int defaultRequiredLevel)
    Deprecated.
    static @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 the defaultRequiredLevel if the resultant state is TriState.DEFAULT.
  • Method Details

    • getPermissionValue

      @NotNull static @NotNull net.fabricmc.fabric.api.util.TriState getPermissionValue(@NotNull @NotNull net.minecraft.commands.SharedSuggestionProvider source, @NotNull @NotNull String permission)
      Gets the state of a permission for the given source.
      Parameters:
      source - the source
      permission - the permission
      Returns:
      the state of the permission
    • check

      static boolean check(@NotNull @NotNull net.minecraft.commands.SharedSuggestionProvider source, @NotNull @NotNull String permission, boolean defaultValue)
      Performs a permission check, falling back to the defaultValue if the resultant state is TriState.DEFAULT.
      Parameters:
      source - the source to perform the check for
      permission - the permission to check
      defaultValue - 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.commands.SharedSuggestionProvider source, @NotNull @NotNull String permission, int defaultRequiredLevel)
      Performs a permission check, falling back to requiring the defaultRequiredLevel if the resultant state is TriState.DEFAULT.
      Parameters:
      source - the source to perform the check for
      permission - the permission to check
      defaultRequiredLevel - 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.commands.SharedSuggestionProvider source, @NotNull @NotNull String permission, @NotNull @NotNull net.minecraft.server.permissions.PermissionLevel defaultRequiredLevel)
      Performs a permission check, falling back to requiring the defaultRequiredLevel if the resultant state is TriState.DEFAULT.
      Parameters:
      source - the source to perform the check for
      permission - the permission to check
      defaultRequiredLevel - 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.commands.SharedSuggestionProvider source, @NotNull @NotNull String permission)
      Performs a permission check, falling back to false if the resultant state is TriState.DEFAULT.
      Parameters:
      source - the source to perform the check for
      permission - the permission to check
      Returns:
      the result of the permission check
    • 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 the defaultValue if the resultant state is TriState.DEFAULT.
      Parameters:
      permission - the permission to check
      defaultValue - 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.
      Creates a predicate which returns the result of performing a permission check, falling back to requiring the defaultRequiredLevel if the resultant state is TriState.DEFAULT.
      Parameters:
      permission - the permission to check
      defaultRequiredLevel - 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 the defaultRequiredLevel if the resultant state is TriState.DEFAULT.
      Parameters:
      permission - the permission to check
      defaultRequiredLevel - 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 to false if the resultant state is TriState.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 the state of a permission for the given entity.
      Parameters:
      entity - the entity
      permission - 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 the defaultValue if the resultant state is TriState.DEFAULT.
      Parameters:
      entity - the entity to perform the check for
      permission - the permission to check
      defaultValue - 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)
      Performs a permission check, falling back to requiring the defaultRequiredLevel if the resultant state is TriState.DEFAULT.
      Parameters:
      entity - the entity to perform the check for
      permission - the permission to check
      defaultRequiredLevel - 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 the defaultRequiredLevel if the resultant state is TriState.DEFAULT.
      Parameters:
      entity - the entity to perform the check for
      permission - the permission to check
      defaultRequiredLevel - 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 to false if the resultant state is TriState.DEFAULT.
      Parameters:
      entity - the entity to perform the check for
      permission - 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 the state of a permission for the given (potentially) offline player.
      Parameters:
      uuid - the uuid of the player
      permission - 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 the defaultValue if the resultant state is TriState.DEFAULT.
      Parameters:
      uuid - the uuid of the player to perform the check for
      permission - the permission to check
      defaultValue - 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 to false if the resultant state is TriState.DEFAULT.
      Parameters:
      uuid - the uuid of the player to perform the check for
      permission - 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 to false if the resultant state is TriState.DEFAULT.
      Parameters:
      profile - the player profile to perform the check for
      permission - the permission to check
      defaultValue - 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 to false if the resultant state is TriState.DEFAULT.
      Parameters:
      profile - the player profile to perform the check for
      permission - 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)
      Performs a permission check, falling back to requiring the defaultRequiredLevel if the resultant state is TriState.DEFAULT.
      Parameters:
      profile - the player profile to perform the check for
      permission - the permission to check
      defaultRequiredLevel - the required permission level to check for as a fallback
      server - 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 the defaultRequiredLevel if the resultant state is TriState.DEFAULT.
      Parameters:
      profile - the player profile to perform the check for
      permission - the permission to check
      defaultRequiredLevel - the required permission level to check for as a fallback
      server - 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 to false if the resultant state is TriState.DEFAULT.
      Parameters:
      entry - the player config entry to perform the check for
      permission - the permission to check
      defaultValue - 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 to false if the resultant state is TriState.DEFAULT.
      Parameters:
      entry - the player config entry to perform the check for
      permission - 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)
      Performs a permission check, falling back to requiring the defaultRequiredLevel if the resultant state is TriState.DEFAULT.
      Parameters:
      entry - the player config entry to perform the check for
      permission - the permission to check
      defaultRequiredLevel - the required permission level to check for as a fallback
      server - 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 the defaultRequiredLevel if the resultant state is TriState.DEFAULT.
      Parameters:
      entry - the player config entry to perform the check for
      permission - the permission to check
      defaultRequiredLevel - the required permission level to check for as a fallback
      server - instance to check permission level
      Returns:
      the result of the permission check