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 me.lucko.luckperms.api.caching.GroupData;
|
||||||
|
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
@ -64,13 +63,4 @@ public interface Group extends PermissionHolder {
|
|||||||
@Override
|
@Override
|
||||||
GroupData getCachedData();
|
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.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@ -80,6 +81,15 @@ public interface PermissionHolder {
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
CachedData getCachedData();
|
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.
|
* 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 me.lucko.luckperms.api.caching.UserData;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -87,15 +86,6 @@ public interface User extends PermissionHolder {
|
|||||||
@Override
|
@Override
|
||||||
UserData getCachedData();
|
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.
|
* 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 me.lucko.luckperms.api.caching.GroupData;
|
||||||
|
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
public final class ApiGroup extends ApiPermissionHolder implements Group {
|
public final class ApiGroup extends ApiPermissionHolder implements Group {
|
||||||
public static me.lucko.luckperms.common.model.Group cast(Group g) {
|
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();
|
return handle.getCachedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public CompletableFuture<Void> refreshCachedData() {
|
|
||||||
return handle.getRefreshBuffer().request();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
if (!(o instanceof ApiGroup)) return false;
|
if (!(o instanceof ApiGroup)) return false;
|
||||||
|
@ -52,6 +52,7 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@ -77,6 +78,11 @@ public class ApiPermissionHolder implements PermissionHolder {
|
|||||||
return handle.getCachedData();
|
return handle.getCachedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompletableFuture<Void> refreshCachedData() {
|
||||||
|
return handle.getRefreshBuffer().request();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ImmutableSetMultimap<ImmutableContextSet, Node> getNodes() {
|
public ImmutableSetMultimap<ImmutableContextSet, Node> getNodes() {
|
||||||
return handle.getEnduringNodes();
|
return handle.getEnduringNodes();
|
||||||
|
@ -35,7 +35,6 @@ import me.lucko.luckperms.api.User;
|
|||||||
import me.lucko.luckperms.api.caching.UserData;
|
import me.lucko.luckperms.api.caching.UserData;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
public final class ApiUser extends ApiPermissionHolder implements User {
|
public final class ApiUser extends ApiPermissionHolder implements User {
|
||||||
public static me.lucko.luckperms.common.model.User cast(User u) {
|
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();
|
return handle.getCachedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public CompletableFuture<Void> refreshCachedData() {
|
|
||||||
return handle.getRefreshBuffer().request();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void refreshPermissions() {
|
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.ContextSet;
|
||||||
import me.lucko.luckperms.api.context.ImmutableContextSet;
|
import me.lucko.luckperms.api.context.ImmutableContextSet;
|
||||||
import me.lucko.luckperms.common.api.delegates.model.ApiPermissionHolder;
|
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.buffers.Cache;
|
||||||
import me.lucko.luckperms.common.caching.HolderCache;
|
import me.lucko.luckperms.common.caching.HolderCache;
|
||||||
import me.lucko.luckperms.common.caching.MetaAccumulator;
|
import me.lucko.luckperms.common.caching.MetaAccumulator;
|
||||||
@ -258,6 +259,8 @@ public abstract class PermissionHolder {
|
|||||||
*/
|
*/
|
||||||
public abstract HolderCache<?> getCachedData();
|
public abstract HolderCache<?> getCachedData();
|
||||||
|
|
||||||
|
public abstract BufferedRequest<Void> getRefreshBuffer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forms a HolderReference for this PermissionHolder.
|
* Forms a HolderReference for this PermissionHolder.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user