Interface IPermissible

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      boolean addPermission​(@NotNull Permission permission)
      Adds a new permission to this permissible and updates it if a permission with that name already exists.
      default boolean addPermission​(@NotNull java.lang.String permission)
      Adds a new permission to this permissible and updates it if a permission with that name already exists.
      default boolean addPermission​(@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 boolean addPermission​(@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.
      boolean addPermission​(@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 boolean addPermission​(@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 boolean addPermission​(@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 boolean addPermission​(@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 int compareTo​(IPermissible o)  
      java.util.Map<java.lang.String,​java.util.Collection<Permission>> getGroupPermissions()
      Gets all effective permissions on a specific group.
      default @Nullable Permission getPermission​(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.
      int getPotency()
      Gets the potency of this permissible.
      default PermissionCheckResult hasPermission​(@NotNull Permission permission)
      Checks whether the given permission is allowed in the list of global permissions in this permissible.
      default PermissionCheckResult hasPermission​(@NotNull java.lang.String permission)
      Checks whether the given permission is allowed in the list of global permissions in this permissible.
      default PermissionCheckResult hasPermission​(@NotNull java.lang.String group, @NotNull Permission permission)
      Checks whether the given permission is allowed in the list of permissions for the specified group in this permissible.
      default PermissionCheckResult hasPermission​(@NotNull java.util.Collection<Permission> permissions, @NotNull Permission permission)
      Checks whether the given permission is allowed in the given list of permissions.
      default boolean isPermissionSet​(@NotNull java.lang.String name)
      Checks if a permission exists in this permissible by its name.
      boolean removePermission​(@NotNull java.lang.String permission)
      Removes a permission out of this permissible.
      boolean removePermission​(@NotNull java.lang.String group, @NotNull java.lang.String permission)
      Removes a permission for a specific group out of this permissible.
      void setName​(@NotNull java.lang.String name)
      Sets the name of this permissible.
      void setPotency​(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.common.INameable

        getName
    • Method Detail

      • 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) or IPermissionManagement.updateGroup(IPermissionGroup) is required.

        Parameters:
        group - the group where this permission should be effective
        permission - the permission
        Returns:
        true if the permission has been added successfully or false if the given permission was null
      • 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) or IPermissionManagement.updateGroup(IPermissionGroup) is required.

        Parameters:
        group - the group where this permission is effective
        permission - the permission
        Returns:
        true if the permission has been removed successfully or false if the given permission doesn'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 Permission if the permission exists or null if 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:
        true if the permission exists or false if 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) or IPermissionManagement.updateGroup(IPermissionGroup) is required.

        Equivalent to #addPermission(permission, 0)

        Parameters:
        permission - the permission
        Returns:
        true if the permission has been added successfully or false if the given permission was 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) or IPermissionManagement.updateGroup(IPermissionGroup) is required.

        Equivalent to #addPermission(permission, value ? 1 : -1)

        Parameters:
        permission - the permission
        value - whether this permission should be applied or not
        Returns:
        true if the permission has been added successfully or false if the given permission was 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) or IPermissionManagement.updateGroup(IPermissionGroup) is required.

        Equivalent to #addPermission(new Permission(permission, potency))

        Parameters:
        permission - the permission
        potency - the potency of the permission
        Returns:
        true if the permission has been added successfully or false if the given permission was 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) or IPermissionManagement.updateGroup(IPermissionGroup) is required.

        Equivalent to #addPermission(group, permission, 0)

        Parameters:
        group - the group where this permission should be effective
        permission - the permission
        Returns:
        true if the permission has been added successfully or false if the given permission was 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) or IPermissionManagement.updateGroup(IPermissionGroup) is required.

        Equivalent to #addPermission(group, permission, 0)

        Parameters:
        group - the group where this permission should be effective
        permission - the permission
        potency - the potency of the permission
        Returns:
        true if the permission has been added successfully or false if the given permission was 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) or IPermissionManagement.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 effective
        permission - the permission
        potency - the potency of the permission
        time - the time when this permission should expire
        unit - the time unit of the time param
        Returns:
        true if the permission has been added successfully or false if the given permission was 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 given permission is allowed in the given list of permissions.
        Parameters:
        permissions - the list of available permissions
        permission - the permission to check
        Returns:
        the result of this check
      • hasPermission

        default PermissionCheckResult hasPermission​(@NotNull
                                                    @NotNull java.lang.String group,
                                                    @NotNull
                                                    @NotNull Permission permission)
        Checks whether the given permission is allowed in the list of permissions for the specified group in this permissible.
        Parameters:
        group - the group to get the available permissions from
        permission - the permission to check for
        Returns:
        the result of this check
      • hasPermission

        default PermissionCheckResult hasPermission​(@NotNull
                                                    @NotNull Permission permission)
        Checks whether the given permission is 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 given permission is 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:
        compareTo in interface java.lang.Comparable<IPermissible>