mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 11:38:40 +01:00
Move a couple more methods around in the API
This commit is contained in:
parent
3e8f7911af
commit
d75b29f51d
@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
package me.lucko.luckperms.api;
|
package me.lucko.luckperms.api;
|
||||||
|
|
||||||
import me.lucko.luckperms.api.context.ContextSet;
|
|
||||||
|
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@ -44,28 +42,6 @@ public interface Group extends PermissionHolder {
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
/**
|
|
||||||
* Check to see if a group inherits another group directly
|
|
||||||
*
|
|
||||||
* @param group The group to check membership of
|
|
||||||
* @return true if the group inherits the other group
|
|
||||||
* @throws NullPointerException if the group is null
|
|
||||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
|
||||||
*/
|
|
||||||
boolean inheritsGroup(@Nonnull Group group);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check to see if a group inherits another group directly
|
|
||||||
*
|
|
||||||
* @param group The group to check membership of
|
|
||||||
* @param contextSet the context set to filter by
|
|
||||||
* @return true if the group inherits the other group
|
|
||||||
* @throws NullPointerException if the group is null
|
|
||||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
|
||||||
* @since 3.2
|
|
||||||
*/
|
|
||||||
boolean inheritsGroup(@Nonnull Group group, @Nonnull ContextSet contextSet);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the weight of this group, if present.
|
* Gets the weight of this group, if present.
|
||||||
*
|
*
|
||||||
|
@ -284,6 +284,29 @@ public interface PermissionHolder {
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
Tristate inheritsPermission(@Nonnull Node node);
|
Tristate inheritsPermission(@Nonnull Node node);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check to see if this holder inherits another group directly
|
||||||
|
*
|
||||||
|
* @param group The group to check membership of
|
||||||
|
* @return true if the group inherits the other group
|
||||||
|
* @throws NullPointerException if the group is null
|
||||||
|
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||||
|
* @since 4.0
|
||||||
|
*/
|
||||||
|
boolean inheritsGroup(@Nonnull Group group);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check to see if this holder inherits another group directly
|
||||||
|
*
|
||||||
|
* @param group The group to check membership of
|
||||||
|
* @param contextSet the context set to filter by
|
||||||
|
* @return true if the group inherits the other group
|
||||||
|
* @throws NullPointerException if the group is null
|
||||||
|
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||||
|
* @since 4.0
|
||||||
|
*/
|
||||||
|
boolean inheritsGroup(@Nonnull Group group, @Nonnull ContextSet contextSet);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a permission for the object
|
* Sets a permission for the object
|
||||||
*
|
*
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
package me.lucko.luckperms.api;
|
package me.lucko.luckperms.api;
|
||||||
|
|
||||||
import me.lucko.luckperms.api.caching.UserData;
|
import me.lucko.luckperms.api.caching.UserData;
|
||||||
import me.lucko.luckperms.api.context.ContextSet;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@ -96,27 +95,6 @@ public interface User extends PermissionHolder {
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
CompletableFuture<Void> refreshCachedData();
|
CompletableFuture<Void> refreshCachedData();
|
||||||
|
|
||||||
/**
|
|
||||||
* Check to see if the user is a direct member of a group
|
|
||||||
*
|
|
||||||
* @param group The group to check membership of
|
|
||||||
* @return true if the user is a member of the group
|
|
||||||
* @throws NullPointerException if the group is null
|
|
||||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
|
||||||
*/
|
|
||||||
boolean isInGroup(@Nonnull Group group);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check to see if the user is a direct member of a group in a specific context
|
|
||||||
*
|
|
||||||
* @param group the group to check membership of
|
|
||||||
* @param contextSet the context set to filter by
|
|
||||||
* @return true if the user is a member of the group
|
|
||||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
|
||||||
* @since 3.2
|
|
||||||
*/
|
|
||||||
boolean isInGroup(@Nonnull Group group, @Nonnull ContextSet contextSet);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh and re-assign the users permissions.
|
* Refresh and re-assign the users permissions.
|
||||||
*
|
*
|
||||||
|
@ -32,7 +32,6 @@ import lombok.NonNull;
|
|||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import me.lucko.luckperms.api.Group;
|
import me.lucko.luckperms.api.Group;
|
||||||
import me.lucko.luckperms.api.context.ContextSet;
|
|
||||||
|
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
|
|
||||||
@ -55,16 +54,6 @@ public final class ApiGroup extends ApiPermissionHolder implements Group {
|
|||||||
return handle.getName();
|
return handle.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean inheritsGroup(@NonNull Group group) {
|
|
||||||
return handle.inheritsGroup(cast(group));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean inheritsGroup(@NonNull Group group, @NonNull ContextSet contextSet) {
|
|
||||||
return handle.inheritsGroup(cast(group), contextSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OptionalInt getWeight() {
|
public OptionalInt getWeight() {
|
||||||
return handle.getWeight();
|
return handle.getWeight();
|
||||||
|
@ -136,6 +136,16 @@ public class ApiPermissionHolder implements PermissionHolder {
|
|||||||
return handle.inheritsPermission(node);
|
return handle.inheritsPermission(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean inheritsGroup(@NonNull me.lucko.luckperms.api.Group group) {
|
||||||
|
return handle.inheritsGroup(ApiGroup.cast(group));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean inheritsGroup(@NonNull me.lucko.luckperms.api.Group group, @NonNull ContextSet contextSet) {
|
||||||
|
return handle.inheritsGroup(ApiGroup.cast(group), contextSet);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataMutateResult setPermission(@NonNull Node node) {
|
public DataMutateResult setPermission(@NonNull Node node) {
|
||||||
return handle.setPermission(node);
|
return handle.setPermission(node);
|
||||||
|
@ -31,10 +31,8 @@ import lombok.NonNull;
|
|||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import me.lucko.luckperms.api.DataMutateResult;
|
import me.lucko.luckperms.api.DataMutateResult;
|
||||||
import me.lucko.luckperms.api.Group;
|
|
||||||
import me.lucko.luckperms.api.User;
|
import me.lucko.luckperms.api.User;
|
||||||
import me.lucko.luckperms.api.caching.UserData;
|
import me.lucko.luckperms.api.caching.UserData;
|
||||||
import me.lucko.luckperms.api.context.ContextSet;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@ -92,16 +90,6 @@ public final class ApiUser extends ApiPermissionHolder implements User {
|
|||||||
return handle.getRefreshBuffer().request();
|
return handle.getRefreshBuffer().request();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isInGroup(@NonNull Group group) {
|
|
||||||
return handle.inheritsGroup(ApiGroup.cast(group));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isInGroup(@NonNull Group group, @NonNull ContextSet contextSet) {
|
|
||||||
return handle.inheritsGroup(ApiGroup.cast(group), contextSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void refreshPermissions() {
|
public void refreshPermissions() {
|
||||||
|
Loading…
Reference in New Issue
Block a user