From c4c98aaabf0c2e4dec6644cdcf2957beb882cb3b Mon Sep 17 00:00:00 2001 From: Luck Date: Fri, 4 May 2018 23:17:06 +0100 Subject: [PATCH] Improve the behaviour of the APIs (now somewhat redundant) holder refresh method --- api/src/main/java/me/lucko/luckperms/api/PermissionHolder.java | 3 +++ .../common/api/delegates/model/ApiPermissionHolder.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/me/lucko/luckperms/api/PermissionHolder.java b/api/src/main/java/me/lucko/luckperms/api/PermissionHolder.java index 5572a1f48..a5181db5f 100644 --- a/api/src/main/java/me/lucko/luckperms/api/PermissionHolder.java +++ b/api/src/main/java/me/lucko/luckperms/api/PermissionHolder.java @@ -84,6 +84,9 @@ public interface PermissionHolder { /** * Refreshes and applies any changes to the cached holder data. * + *

Calling this method is unnecessary in most cases. Cache updates are handled + * behind the scenes by the implementation.

+ * * @return the task future * @since 4.0 */ diff --git a/common/src/main/java/me/lucko/luckperms/common/api/delegates/model/ApiPermissionHolder.java b/common/src/main/java/me/lucko/luckperms/common/api/delegates/model/ApiPermissionHolder.java index ab7a87636..ead7cc132 100644 --- a/common/src/main/java/me/lucko/luckperms/common/api/delegates/model/ApiPermissionHolder.java +++ b/common/src/main/java/me/lucko/luckperms/common/api/delegates/model/ApiPermissionHolder.java @@ -99,7 +99,7 @@ public class ApiPermissionHolder implements me.lucko.luckperms.api.PermissionHol @Nonnull @Override public CompletableFuture refreshCachedData() { - return this.handle.getCachedData().reloadAll(); + return CompletableFuture.runAsync(() -> this.handle.getCachedData().invalidateCaches()); } @Nonnull