Interface IPermissible
-
- All Superinterfaces:
java.lang.Comparable<IPermissible>,de.dytanic.cloudnet.common.document.gson.IJsonDocPropertyable,de.dytanic.cloudnet.common.INameable,SerializableObject
- All Known Subinterfaces:
IPermissionGroup,IPermissionUser
- All Known Implementing Classes:
AbstractPermissible,PermissionGroup,PermissionUser
public interface IPermissible extends de.dytanic.cloudnet.common.INameable, de.dytanic.cloudnet.common.document.gson.IJsonDocPropertyable, java.lang.Comparable<IPermissible>, SerializableObject
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleanaddPermission(@NotNull Permission permission)Adds a new permission to this permissible and updates it if a permission with that name already exists.default booleanaddPermission(@NotNull java.lang.String permission)Adds a new permission to this permissible and updates it if a permission with that name already exists.default booleanaddPermission(@NotNull java.lang.String permission, boolean value)Adds a new permission to this permissible and updates it if a permission with that name already exists.default booleanaddPermission(@NotNull java.lang.String permission, int potency)Adds a new permission to this permissible and updates it if a permission with that name already exists.booleanaddPermission(@NotNull java.lang.String group, @NotNull Permission permission)Adds a new permission to this permissible and updates it if a permission with that name already exists.default booleanaddPermission(@NotNull java.lang.String group, @NotNull java.lang.String permission)Adds a new permission to this permissible and updates it if a permission with that name already exists.default booleanaddPermission(@NotNull java.lang.String group, @NotNull java.lang.String permission, int potency)Adds a new permission to this permissible and updates it if a permission with that name already exists.default booleanaddPermission(@NotNull java.lang.String group, @NotNull java.lang.String permission, int potency, long time, java.util.concurrent.TimeUnit unit)Adds a new permission to this permissible and updates it if a permission with that name already exists.default intcompareTo(IPermissible o)default @Nullable PermissionfindMatchingPermission(@NotNull java.util.Collection<Permission> permissions, @NotNull Permission permission)Finds the best matching permission in the givenpermissionsby logically checking the absolute potency against each other to find the permission with the highest positive or negative potency.java.util.Collection<java.lang.String>getGroupNames()java.util.Map<java.lang.String,java.util.Collection<Permission>>getGroupPermissions()Gets all effective permissions on a specific group.default @Nullable PermissiongetPermission(java.lang.String name)Gets a permission of this permissible by its name.default java.util.Collection<java.lang.String>getPermissionNames()Gets a list of the names of all global permissions of this permissible.java.util.Collection<Permission>getPermissions()Gets all effective global permissions.intgetPotency()Gets the potency of this permissible.default PermissionCheckResulthasPermission(@NotNull Permission permission)Checks whether the givenpermissionis allowed in the list of global permissions in this permissible.default PermissionCheckResulthasPermission(@NotNull java.lang.String permission)Checks whether the givenpermissionis allowed in the list of global permissions in this permissible.default PermissionCheckResulthasPermission(@NotNull java.lang.String group, @NotNull Permission permission)Checks whether the givenpermissionis allowed in the list of permissions for the specified group in this permissible.default PermissionCheckResulthasPermission(@NotNull java.util.Collection<Permission> permissions, @NotNull Permission permission)Checks whether the givenpermissionis allowed in the given list of permissions.default booleanisPermissionSet(@NotNull java.lang.String name)Checks if a permission exists in this permissible by its name.booleanremovePermission(@NotNull java.lang.String permission)Removes a permission out of this permissible.booleanremovePermission(@NotNull java.lang.String group, @NotNull java.lang.String permission)Removes a permission for a specific group out of this permissible.voidsetName(@NotNull java.lang.String name)Sets the name of this permissible.voidsetPotency(int potency)Sets the potency of this permissible.-
Methods inherited from interface de.dytanic.cloudnet.common.document.gson.IJsonDocPropertyable
getProperties, getProperty, hasProperty, removeProperty, setProperty
-
Methods inherited from interface de.dytanic.cloudnet.driver.serialization.SerializableObject
read, write
-
-
-
-
Method Detail
-
getGroupNames
java.util.Collection<java.lang.String> getGroupNames()
-
setName
void setName(@NotNull @NotNull java.lang.String name)Sets the name of this permissible.An update via
IPermissionManagement.updateGroup(IPermissionGroup)orIPermissionManagement.updateGroup(IPermissionGroup)is required.- Parameters:
name- the new name
-
getPotency
int getPotency()
Gets the potency of this permissible. If this permissible is anIPermissionGroup,IPermissionManagement.getHighestPermissionGroup(IPermissionUser)is sorted by the potency. If this permissible is anIPermissionUser, in CloudNet it has no specific meaning, but of course you can use it for whatever you want.- Returns:
- the potency of this permissible
-
setPotency
void setPotency(int potency)
Sets the potency of this permissible.An update via
IPermissionManagement.updateGroup(IPermissionGroup)orIPermissionManagement.updateGroup(IPermissionGroup)is required.- Parameters:
potency- the new potency
-
addPermission
boolean addPermission(@NotNull @NotNull Permission permission)Adds a new permission to this permissible and updates it if a permission with that name already exists.An update via
IPermissionManagement.updateGroup(IPermissionGroup)orIPermissionManagement.updateGroup(IPermissionGroup)is required.- Parameters:
permission- the permission- Returns:
trueif the permission has been added successfully orfalseif the givenpermissionwas null
-
addPermission
boolean addPermission(@NotNull @NotNull java.lang.String group, @NotNull @NotNull Permission permission)Adds a new permission to this permissible and updates it if a permission with that name already exists. This permission will be only effective on servers which have the specified group.An update via
IPermissionManagement.updateGroup(IPermissionGroup)orIPermissionManagement.updateGroup(IPermissionGroup)is required.- Parameters:
group- the group where this permission should be effectivepermission- the permission- Returns:
trueif the permission has been added successfully orfalseif the givenpermissionwas null
-
removePermission
boolean removePermission(@NotNull @NotNull java.lang.String permission)Removes a permission out of this permissible.An update via
IPermissionManagement.updateGroup(IPermissionGroup)orIPermissionManagement.updateGroup(IPermissionGroup)is required.- Parameters:
permission- the permission- Returns:
trueif the permission has been removed successfully orfalseif the givenpermissiondoesn't exist
-
removePermission
boolean removePermission(@NotNull @NotNull java.lang.String group, @NotNull @NotNull java.lang.String permission)Removes a permission for a specific group out of this permissible.An update via
IPermissionManagement.updateGroup(IPermissionGroup)orIPermissionManagement.updateGroup(IPermissionGroup)is required.- Parameters:
group- the group where this permission is effectivepermission- the permission- Returns:
trueif the permission has been removed successfully orfalseif the givenpermissiondoesn't exist
-
getPermissions
java.util.Collection<Permission> getPermissions()
Gets all effective global permissions. Permissions which are only effective on specific groups are not included.- Returns:
- a mutable list of all permissions
-
getGroupPermissions
java.util.Map<java.lang.String,java.util.Collection<Permission>> getGroupPermissions()
Gets all effective permissions on a specific group. Global permissions are not included.- Returns:
- a mutable map containing mutable lists of permissions
-
getPermission
@Nullable default @Nullable Permission getPermission(java.lang.String name)
Gets a permission of this permissible by its name.- Parameters:
name- the case-insensitive name of the permission- Returns:
- the
Permissionif the permission exists ornullif the permission doesn't exist in this permissible or the name is null
-
isPermissionSet
default boolean isPermissionSet(@NotNull @NotNull java.lang.String name)Checks if a permission exists in this permissible by its name.- Parameters:
name- the case-insensitive name of the permission- Returns:
trueif the permission exists orfalseif the permission doesn't exist in this permissible or this name is null
-
addPermission
default boolean addPermission(@NotNull @NotNull java.lang.String permission)Adds a new permission to this permissible and updates it if a permission with that name already exists.An update via
IPermissionManagement.updateGroup(IPermissionGroup)orIPermissionManagement.updateGroup(IPermissionGroup)is required.Equivalent to
#addPermission(permission, 0)- Parameters:
permission- the permission- Returns:
trueif the permission has been added successfully orfalseif the givenpermissionwas null
-
addPermission
default boolean addPermission(@NotNull @NotNull java.lang.String permission, boolean value)Adds a new permission to this permissible and updates it if a permission with that name already exists.An update via
IPermissionManagement.updateGroup(IPermissionGroup)orIPermissionManagement.updateGroup(IPermissionGroup)is required.Equivalent to
#addPermission(permission, value ? 1 : -1)- Parameters:
permission- the permissionvalue- whether this permission should be applied or not- Returns:
trueif the permission has been added successfully orfalseif the givenpermissionwas null
-
addPermission
default boolean addPermission(@NotNull @NotNull java.lang.String permission, int potency)Adds a new permission to this permissible and updates it if a permission with that name already exists.An update via
IPermissionManagement.updateGroup(IPermissionGroup)orIPermissionManagement.updateGroup(IPermissionGroup)is required.Equivalent to
#addPermission(new Permission(permission, potency))- Parameters:
permission- the permissionpotency- the potency of the permission- Returns:
trueif the permission has been added successfully orfalseif the givenpermissionwas null
-
addPermission
default boolean addPermission(@NotNull @NotNull java.lang.String group, @NotNull @NotNull java.lang.String permission)Adds a new permission to this permissible and updates it if a permission with that name already exists.An update via
IPermissionManagement.updateGroup(IPermissionGroup)orIPermissionManagement.updateGroup(IPermissionGroup)is required.Equivalent to
#addPermission(group, permission, 0)- Parameters:
group- the group where this permission should be effectivepermission- the permission- Returns:
trueif the permission has been added successfully orfalseif the givenpermissionwas null
-
addPermission
default boolean addPermission(@NotNull @NotNull java.lang.String group, @NotNull @NotNull java.lang.String permission, int potency)Adds a new permission to this permissible and updates it if a permission with that name already exists.An update via
IPermissionManagement.updateGroup(IPermissionGroup)orIPermissionManagement.updateGroup(IPermissionGroup)is required.Equivalent to
#addPermission(group, permission, 0)- Parameters:
group- the group where this permission should be effectivepermission- the permissionpotency- the potency of the permission- Returns:
trueif the permission has been added successfully orfalseif the givenpermissionwas null
-
addPermission
default boolean addPermission(@NotNull @NotNull java.lang.String group, @NotNull @NotNull java.lang.String permission, int potency, long time, java.util.concurrent.TimeUnit unit)Adds a new permission to this permissible and updates it if a permission with that name already exists.An update via
IPermissionManagement.updateGroup(IPermissionGroup)orIPermissionManagement.updateGroup(IPermissionGroup)is required.Equivalent to
#addPermission(group, new Permission(permission, potency, (System.currentTimeMillis() + millis.toMillis(time))))- Parameters:
group- the group where this permission should be effectivepermission- the permissionpotency- the potency of the permissiontime- the time when this permission should expireunit- the time unit of thetimeparam- Returns:
trueif the permission has been added successfully orfalseif the givenpermissionwas null
-
getPermissionNames
default java.util.Collection<java.lang.String> getPermissionNames()
Gets a list of the names of all global permissions of this permissible. Modifications of this list are useless.- Returns:
- a mutable list of all names of the permissions
-
hasPermission
default PermissionCheckResult hasPermission(@NotNull @NotNull java.util.Collection<Permission> permissions, @NotNull @NotNull Permission permission)
Checks whether the givenpermissionis allowed in the given list of permissions.- Parameters:
permissions- the list of available permissionspermission- the permission to check- Returns:
- the result of this check
-
findMatchingPermission
@Nullable default @Nullable Permission findMatchingPermission(@NotNull @NotNull java.util.Collection<Permission> permissions, @NotNull @NotNull Permission permission)
Finds the best matching permission in the givenpermissionsby logically checking the absolute potency against each other to find the permission with the highest positive or negative potency.- Parameters:
permissions- the permission to check for.permission- the initial permission to check against.- Returns:
- the logic permission which has the highest potency.
-
hasPermission
default PermissionCheckResult hasPermission(@NotNull @NotNull java.lang.String group, @NotNull @NotNull Permission permission)
Checks whether the givenpermissionis allowed in the list of permissions for the specified group in this permissible.- Parameters:
group- the group to get the available permissions frompermission- the permission to check for- Returns:
- the result of this check
-
hasPermission
default PermissionCheckResult hasPermission(@NotNull @NotNull Permission permission)
Checks whether the givenpermissionis allowed in the list of global permissions in this permissible.- Parameters:
permission- the permission to check for- Returns:
- the result of this check
-
hasPermission
default PermissionCheckResult hasPermission(@NotNull @NotNull java.lang.String permission)
Checks whether the givenpermissionis allowed in the list of global permissions in this permissible.Equivalent to
#hasPermission(new Permission(permission, 0)- Parameters:
permission- the permission to check for- Returns:
- the result of this check
-
compareTo
default int compareTo(IPermissible o)
- Specified by:
compareToin interfacejava.lang.Comparable<IPermissible>
-
-