Move a couple more methods around in the API

This commit is contained in:
Luck 2017-11-08 15:48:55 +00:00
parent 3e8f7911af
commit d75b29f51d
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
6 changed files with 33 additions and 69 deletions

View File

@ -25,8 +25,6 @@
package me.lucko.luckperms.api;
import me.lucko.luckperms.api.context.ContextSet;
import java.util.OptionalInt;
import javax.annotation.Nonnull;
@ -44,28 +42,6 @@ public interface Group extends PermissionHolder {
@Nonnull
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.
*

View File

@ -284,6 +284,29 @@ public interface PermissionHolder {
@Nonnull
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
*

View File

@ -26,7 +26,6 @@
package me.lucko.luckperms.api;
import me.lucko.luckperms.api.caching.UserData;
import me.lucko.luckperms.api.context.ContextSet;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@ -96,27 +95,6 @@ public interface User extends PermissionHolder {
@Nonnull
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.
*

View File

@ -32,7 +32,6 @@ import lombok.NonNull;
import com.google.common.base.Preconditions;
import me.lucko.luckperms.api.Group;
import me.lucko.luckperms.api.context.ContextSet;
import java.util.OptionalInt;
@ -55,16 +54,6 @@ public final class ApiGroup extends ApiPermissionHolder implements Group {
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
public OptionalInt getWeight() {
return handle.getWeight();

View File

@ -136,6 +136,16 @@ public class ApiPermissionHolder implements PermissionHolder {
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
public DataMutateResult setPermission(@NonNull Node node) {
return handle.setPermission(node);

View File

@ -31,10 +31,8 @@ import lombok.NonNull;
import com.google.common.base.Preconditions;
import me.lucko.luckperms.api.DataMutateResult;
import me.lucko.luckperms.api.Group;
import me.lucko.luckperms.api.User;
import me.lucko.luckperms.api.caching.UserData;
import me.lucko.luckperms.api.context.ContextSet;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@ -92,16 +90,6 @@ public final class ApiUser extends ApiPermissionHolder implements User {
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
@Deprecated
public void refreshPermissions() {