mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 11:38:40 +01:00
Move #refreshCachedData up the type hierarchy into PermissionHolder
This commit is contained in:
parent
a115ff8ce2
commit
14005563a3
@ -28,7 +28,6 @@ package me.lucko.luckperms.api;
|
||||
import me.lucko.luckperms.api.caching.GroupData;
|
||||
|
||||
import java.util.OptionalInt;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@ -64,13 +63,4 @@ public interface Group extends PermissionHolder {
|
||||
@Override
|
||||
GroupData getCachedData();
|
||||
|
||||
/**
|
||||
* Refreshes and applies any changes to the cached group data.
|
||||
*
|
||||
* @return the task future
|
||||
* @since 4.0
|
||||
*/
|
||||
@Nonnull
|
||||
CompletableFuture<Void> refreshCachedData();
|
||||
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@ -80,6 +81,15 @@ public interface PermissionHolder {
|
||||
@Nonnull
|
||||
CachedData getCachedData();
|
||||
|
||||
/**
|
||||
* Refreshes and applies any changes to the cached holder data.
|
||||
*
|
||||
* @return the task future
|
||||
* @since 4.0
|
||||
*/
|
||||
@Nonnull
|
||||
CompletableFuture<Void> refreshCachedData();
|
||||
|
||||
/**
|
||||
* Gets the backing multimap containing every permission this holder has.
|
||||
*
|
||||
|
@ -28,7 +28,6 @@ package me.lucko.luckperms.api;
|
||||
import me.lucko.luckperms.api.caching.UserData;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@ -87,15 +86,6 @@ public interface User extends PermissionHolder {
|
||||
@Override
|
||||
UserData getCachedData();
|
||||
|
||||
/**
|
||||
* Refreshes and applies any changes to the cached user data.
|
||||
*
|
||||
* @return the task future
|
||||
* @since 4.0
|
||||
*/
|
||||
@Nonnull
|
||||
CompletableFuture<Void> refreshCachedData();
|
||||
|
||||
/**
|
||||
* Refresh and re-assign the users permissions.
|
||||
*
|
||||
|
@ -35,7 +35,6 @@ import me.lucko.luckperms.api.Group;
|
||||
import me.lucko.luckperms.api.caching.GroupData;
|
||||
|
||||
import java.util.OptionalInt;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public final class ApiGroup extends ApiPermissionHolder implements Group {
|
||||
public static me.lucko.luckperms.common.model.Group cast(Group g) {
|
||||
@ -66,11 +65,6 @@ public final class ApiGroup extends ApiPermissionHolder implements Group {
|
||||
return handle.getCachedData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> refreshCachedData() {
|
||||
return handle.getRefreshBuffer().request();
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) return true;
|
||||
if (!(o instanceof ApiGroup)) return false;
|
||||
|
@ -52,6 +52,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@AllArgsConstructor
|
||||
@ -77,6 +78,11 @@ public class ApiPermissionHolder implements PermissionHolder {
|
||||
return handle.getCachedData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> refreshCachedData() {
|
||||
return handle.getRefreshBuffer().request();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSetMultimap<ImmutableContextSet, Node> getNodes() {
|
||||
return handle.getEnduringNodes();
|
||||
|
@ -35,7 +35,6 @@ import me.lucko.luckperms.api.User;
|
||||
import me.lucko.luckperms.api.caching.UserData;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public final class ApiUser extends ApiPermissionHolder implements User {
|
||||
public static me.lucko.luckperms.common.model.User cast(User u) {
|
||||
@ -85,11 +84,6 @@ public final class ApiUser extends ApiPermissionHolder implements User {
|
||||
return handle.getCachedData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> refreshCachedData() {
|
||||
return handle.getRefreshBuffer().request();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void refreshPermissions() {
|
||||
|
@ -46,6 +46,7 @@ import me.lucko.luckperms.api.Tristate;
|
||||
import me.lucko.luckperms.api.context.ContextSet;
|
||||
import me.lucko.luckperms.api.context.ImmutableContextSet;
|
||||
import me.lucko.luckperms.common.api.delegates.model.ApiPermissionHolder;
|
||||
import me.lucko.luckperms.common.buffers.BufferedRequest;
|
||||
import me.lucko.luckperms.common.buffers.Cache;
|
||||
import me.lucko.luckperms.common.caching.HolderCache;
|
||||
import me.lucko.luckperms.common.caching.MetaAccumulator;
|
||||
@ -258,6 +259,8 @@ public abstract class PermissionHolder {
|
||||
*/
|
||||
public abstract HolderCache<?> getCachedData();
|
||||
|
||||
public abstract BufferedRequest<Void> getRefreshBuffer();
|
||||
|
||||
/**
|
||||
* Forms a HolderReference for this PermissionHolder.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user