Package net.minestom.server.permission
Interface Permission<T>
- Type Parameters:
T
- the type of data that this permission can handle inisValidFor(PermissionHandler, Object)
. Used if you want to allow passing additional data to check if the permission is valid in a certain situation, you can default it toObject
if you do not need it.
- All Known Implementing Classes:
BasicPermission
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface Permission<T>
Representation of a permission granted to a
CommandSender
.-
Method Summary
Modifier and Type Method Description boolean
isValidFor(PermissionHandler permissionHandler, T data)
Does the givenCommandSender
have the permission represented by this object?default Permission
read(Data source)
Reads any required data for this permission from the given destination.default void
write(Data destination)
Writes any required data for this permission inside the given destination.
-
Method Details
-
isValidFor
Does the givenCommandSender
have the permission represented by this object?Called with
PermissionHandler.hasPermission(Permission)
, theCommandSender
requires to both have this permission and validate the condition in this method.- Parameters:
permissionHandler
- the permission handlerdata
- the optional data (eg the number of home possible, placing a block at X position)- Returns:
- true if the commandSender possesses this permission
-
write
Writes any required data for this permission inside the given destination.- Parameters:
destination
- theData
to write to
-
read
Reads any required data for this permission from the given destination.- Parameters:
source
- theData
to read from- Returns:
- this for chaining
-