From 163e6e0f2a5d636132e7ff6d01a1b69e23c81137 Mon Sep 17 00:00:00 2001 From: Luck Date: Tue, 2 May 2017 16:55:08 +0100 Subject: [PATCH] Always load user data caches alongside user instances --- .locale/en_US.yml | 2 +- .../luckperms/bukkit/BukkitListener.java | 10 +---- .../luckperms/bukkit/LPBukkitPlugin.java | 8 +--- .../luckperms/bukkit/model/LPPermissible.java | 38 +++++++------------ .../luckperms/bukkit/vault/VaultChatHook.java | 8 ---- .../bukkit/vault/VaultPermissionHook.java | 4 -- .../luckperms/bungee/BungeeListener.java | 17 +-------- .../common/api/delegates/UserDelegate.java | 5 ++- .../luckperms/common/caching/UserCache.java | 14 +++---- .../commands/impl/misc/CheckCommand.java | 9 +---- .../commands/impl/misc/TreeCommand.java | 9 +---- .../common/commands/impl/user/UserInfo.java | 28 ++++++-------- .../luckperms/common/constants/Message.java | 2 +- .../luckperms/common/core/model/User.java | 37 +++++++----------- .../luckperms/common/utils/LoginHelper.java | 2 +- .../sponge/managers/SpongeUserManager.java | 13 +------ .../luckperms/sponge/model/SpongeUser.java | 11 ------ .../sponge/service/LuckPermsService.java | 4 -- 18 files changed, 59 insertions(+), 162 deletions(-) diff --git a/.locale/en_US.yml b/.locale/en_US.yml index 77a87916c..aee4233d9 100644 --- a/.locale/en_US.yml +++ b/.locale/en_US.yml @@ -214,7 +214,7 @@ user-info-general: > {PREFIX}&f- &3Meta: &a{8} user-info-data: > {PREFIX}&f- &aCached Data:\n - {PREFIX}&f- &3Is Loaded: {0}\n + {PREFIX}&f- &3Has contextual data: {0}\n {PREFIX}&f- &3Current Contexts: {1}\n {PREFIX}&f- &3Current Prefix: {2}\n {PREFIX}&f- &3Current Suffix: {3} diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitListener.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitListener.java index 3a2a295cd..2b5892449 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitListener.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitListener.java @@ -29,7 +29,6 @@ import lombok.RequiredArgsConstructor; import me.lucko.luckperms.bukkit.model.Injector; import me.lucko.luckperms.bukkit.model.LPPermissible; -import me.lucko.luckperms.common.caching.UserCache; import me.lucko.luckperms.common.config.ConfigKeys; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.core.model.User; @@ -182,14 +181,7 @@ public class BukkitListener implements Listener { // We assume all users are not op, but those who are need extra calculation. if (player.isOp()) { - plugin.doAsync(() -> { - UserCache userData = user.getUserData(); - if (userData == null) { - return; - } - - userData.preCalculate(plugin.getPreProcessContexts(true)); - }); + plugin.doAsync(() -> user.getUserData().preCalculate(plugin.getPreProcessContexts(true))); } } diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java index c99202bde..9ca2873af 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java @@ -42,7 +42,6 @@ import me.lucko.luckperms.bukkit.model.LPPermissible; import me.lucko.luckperms.bukkit.vault.VaultHook; import me.lucko.luckperms.common.api.ApiHandler; import me.lucko.luckperms.common.api.ApiProvider; -import me.lucko.luckperms.common.caching.UserCache; import me.lucko.luckperms.common.caching.handlers.CachedStateManager; import me.lucko.luckperms.common.calculators.CalculatorFactory; import me.lucko.luckperms.common.commands.sender.Sender; @@ -474,12 +473,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { return; } - UserCache userData = user.getUserData(); - if (userData == null) { - return; - } - - Map backing = userData.getPermissionData(permissible.calculateContexts()).getImmutableBacking(); + Map backing = user.getUserData().getPermissionData(permissible.calculateContexts()).getImmutableBacking(); boolean op = Optional.ofNullable(backing.get("luckperms.autoop")).orElse(false); player.setOp(op); } catch (Exception ignored) {} diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/model/LPPermissible.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/model/LPPermissible.java index e78e76baa..9c32bac8c 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/model/LPPermissible.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/model/LPPermissible.java @@ -76,7 +76,7 @@ public class LPPermissible extends PermissibleBase { private final Map attachmentPermissions = new ConcurrentHashMap<>(); private final List attachments = Collections.synchronizedList(new LinkedList<>()); - public LPPermissible(@NonNull Player parent, User user, LPBukkitPlugin plugin) { + public LPPermissible(@NonNull Player parent, @NonNull User user, @NonNull LPBukkitPlugin plugin) { super(parent); this.user = user; this.parent = parent; @@ -139,10 +139,6 @@ public class LPPermissible extends PermissibleBase { ); } - private boolean hasData() { - return user != null && user.getUserData() != null; - } - @Override public void setOp(boolean value) { parent.setOp(value); @@ -150,7 +146,7 @@ public class LPPermissible extends PermissibleBase { @Override public boolean isPermissionSet(@NonNull String name) { - return hasData() && user.getUserData().getPermissionData(calculateContexts()).getPermissionValue(name) != Tristate.UNDEFINED; + return user.getUserData().getPermissionData(calculateContexts()).getPermissionValue(name) != Tristate.UNDEFINED; } @Override @@ -160,11 +156,9 @@ public class LPPermissible extends PermissibleBase { @Override public boolean hasPermission(@NonNull String name) { - if (hasData()) { - Tristate ts = user.getUserData().getPermissionData(calculateContexts()).getPermissionValue(name); - if (ts != Tristate.UNDEFINED) { - return ts.asBoolean(); - } + Tristate ts = user.getUserData().getPermissionData(calculateContexts()).getPermissionValue(name); + if (ts != Tristate.UNDEFINED) { + return ts.asBoolean(); } return Permission.DEFAULT_PERMISSION.getValue(isOp()); @@ -172,11 +166,9 @@ public class LPPermissible extends PermissibleBase { @Override public boolean hasPermission(@NonNull Permission perm) { - if (hasData()) { - Tristate ts = user.getUserData().getPermissionData(calculateContexts()).getPermissionValue(perm.getName()); - if (ts != Tristate.UNDEFINED) { - return ts.asBoolean(); - } + Tristate ts = user.getUserData().getPermissionData(calculateContexts()).getPermissionValue(perm.getName()); + if (ts != Tristate.UNDEFINED) { + return ts.asBoolean(); } return perm.getDefault().getValue(isOp()); @@ -187,13 +179,11 @@ public class LPPermissible extends PermissibleBase { Set perms = new HashSet<>(); perms.addAll(attachmentPermissions.values()); - if (hasData()) { - perms.addAll( - user.getUserData().getPermissionData(calculateContexts()).getImmutableBacking().entrySet().stream() - .map(e -> new PermissionAttachmentInfo(parent, e.getKey(), null, e.getValue())) - .collect(Collectors.toList()) - ); - } + perms.addAll( + user.getUserData().getPermissionData(calculateContexts()).getImmutableBacking().entrySet().stream() + .map(e -> new PermissionAttachmentInfo(parent, e.getKey(), null, e.getValue())) + .collect(Collectors.toList()) + ); return perms; } @@ -288,7 +278,7 @@ public class LPPermissible extends PermissibleBase { calculateChildPermissions(attachment.getPermissions(), false, attachment); } - if (hasData() && invalidate) { + if (invalidate) { user.getUserData().invalidatePermissionCalculators(); } } diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultChatHook.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultChatHook.java index fbd19279d..199736f1f 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultChatHook.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultChatHook.java @@ -126,10 +126,6 @@ public class VaultChatHook extends Chat { perms.log("Getting meta: '" + node + "' for user " + user.getFriendlyName() + " on world " + world + ", server " + perms.getServer()); - if (user.getUserData() == null) { - return defaultValue; - } - String ret = user.getUserData().getMetaData(perms.createContextForWorld(world)).getMeta().get(node); if (ret == null) { return defaultValue; @@ -144,10 +140,6 @@ public class VaultChatHook extends Chat { perms.log("Getting " + (prefix ? "prefix" : "suffix") + " for user " + user.getFriendlyName() + " on world " + world + ", server " + perms.getServer()); - if (user.getUserData() == null) { - return ""; - } - MetaData data = user.getUserData().getMetaData(perms.createContextForWorld(world)); String v = prefix ? data.getPrefix() : data.getSuffix(); return v == null ? "" : unescapeCharacters(v); diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultPermissionHook.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultPermissionHook.java index 66ea7a0c2..043f01575 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultPermissionHook.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultPermissionHook.java @@ -164,10 +164,6 @@ public class VaultPermissionHook extends Permission { User user = plugin.getUserManager().getByUsername(player); if (user == null) return false; - if (user.getUserData() == null) { - return false; - } - // Effectively fallback to the standard Bukkit #hasPermission check. return user.getUserData().getPermissionData(createContextForWorld(world)).getPermissionValue(permission).asBoolean(); } diff --git a/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeListener.java b/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeListener.java index 62f980534..c54878582 100644 --- a/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeListener.java +++ b/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeListener.java @@ -29,7 +29,6 @@ import lombok.RequiredArgsConstructor; import me.lucko.luckperms.api.Contexts; import me.lucko.luckperms.api.Tristate; -import me.lucko.luckperms.api.caching.UserData; import me.lucko.luckperms.api.context.MutableContextSet; import me.lucko.luckperms.common.config.ConfigKeys; import me.lucko.luckperms.common.constants.Message; @@ -166,14 +165,6 @@ public class BungeeListener implements Listener { return; } - UserData userData = user.getUserData(); - if (userData == null) { - plugin.getLog().warn("Player " + player.getName() + " does not have any user data setup."); - plugin.doAsync(() -> user.setupData(false)); - e.setHasPermission(false); - return; - } - Contexts contexts = new Contexts( plugin.getContextManager().getApplicableContext(player), plugin.getConfiguration().get(ConfigKeys.INCLUDING_GLOBAL_PERMS), @@ -184,7 +175,7 @@ public class BungeeListener implements Listener { false ); - Tristate result = userData.getPermissionData(contexts).getPermissionValue(e.getPermission()); + Tristate result = user.getUserData().getPermissionData(contexts).getPermissionValue(e.getPermission()); if (result == Tristate.UNDEFINED && plugin.getConfiguration().get(ConfigKeys.APPLY_BUNGEE_CONFIG_PERMISSIONS)) { return; // just use the result provided by the proxy when the event was created } @@ -207,10 +198,6 @@ public class BungeeListener implements Listener { if (user == null) { return; } - UserData userData = user.getUserData(); - if (userData == null) { - return; - } Contexts contexts = new Contexts( set.makeImmutable(), @@ -222,7 +209,7 @@ public class BungeeListener implements Listener { false ); - userData.preCalculate(contexts); + user.getUserData().preCalculate(contexts); }); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/api/delegates/UserDelegate.java b/common/src/main/java/me/lucko/luckperms/common/api/delegates/UserDelegate.java index ebbecc13f..1ee0f8cb2 100644 --- a/common/src/main/java/me/lucko/luckperms/common/api/delegates/UserDelegate.java +++ b/common/src/main/java/me/lucko/luckperms/common/api/delegates/UserDelegate.java @@ -97,12 +97,13 @@ public final class UserDelegate extends PermissionHolderDelegate implements User @Override public Optional getUserDataCache() { - return Optional.ofNullable(handle.getUserData()); + // TODO Deprecate this and return a nonnull instance + return Optional.of(handle.getUserData()); } @Override public void setupDataCache() { - handle.setupData(false); + handle.preCalculateData(false); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/common/caching/UserCache.java b/common/src/main/java/me/lucko/luckperms/common/caching/UserCache.java index 2ae737390..50f0b42e5 100644 --- a/common/src/main/java/me/lucko/luckperms/common/caching/UserCache.java +++ b/common/src/main/java/me/lucko/luckperms/common/caching/UserCache.java @@ -37,7 +37,6 @@ import me.lucko.luckperms.api.Contexts; import me.lucko.luckperms.api.caching.MetaData; import me.lucko.luckperms.api.caching.PermissionData; import me.lucko.luckperms.api.caching.UserData; -import me.lucko.luckperms.common.calculators.CalculatorFactory; import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.utils.ExtractedContexts; @@ -50,17 +49,11 @@ import java.util.concurrent.TimeUnit; @RequiredArgsConstructor public class UserCache implements UserData { - /** * The user whom this data instance is representing */ private final User user; - /** - * A provider of {@link me.lucko.luckperms.common.calculators.PermissionCalculator}s for the instance - */ - private final CalculatorFactory calculatorFactory; - private final LoadingCache permission = Caffeine.newBuilder() .expireAfterAccess(10, TimeUnit.MINUTES) .build(new CacheLoader() { @@ -103,7 +96,7 @@ public class UserCache implements UserData { @Override public PermissionCache calculatePermissions(@NonNull Contexts contexts) { - PermissionCache data = new PermissionCache(contexts, user, calculatorFactory); + PermissionCache data = new PermissionCache(contexts, user, user.getPlugin().getCalculatorFactory()); data.setPermissions(user.exportNodes(ExtractedContexts.generate(contexts), true)); return data; } @@ -163,4 +156,9 @@ public class UserCache implements UserData { meta.cleanUp(); } + public void clear() { + permission.invalidateAll(); + meta.invalidateAll(); + } + } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/CheckCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/CheckCommand.java index 008f9550a..d9bac383c 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/CheckCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/CheckCommand.java @@ -26,7 +26,6 @@ package me.lucko.luckperms.common.commands.impl.misc; import me.lucko.luckperms.api.Tristate; -import me.lucko.luckperms.common.caching.UserCache; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -71,13 +70,7 @@ public class CheckCommand extends SingleCommand { return CommandResult.STATE_ERROR; } - UserCache data = user.getUserData(); - if (data == null) { - Message.USER_NO_DATA.send(sender, user.getFriendlyName()); - return CommandResult.STATE_ERROR; - } - - Tristate tristate = data.getPermissionData(plugin.getContextForUser(user)).getPermissionValue(permission); + Tristate tristate = user.getUserData().getPermissionData(plugin.getContextForUser(user)).getPermissionValue(permission); Message.CHECK_RESULT.send(sender, user.getFriendlyName(), permission, Util.formatTristate(tristate)); return CommandResult.SUCCESS; } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/TreeCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/TreeCommand.java index f37692b62..cba45f98f 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/TreeCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/TreeCommand.java @@ -26,7 +26,6 @@ package me.lucko.luckperms.common.commands.impl.misc; import me.lucko.luckperms.api.caching.PermissionData; -import me.lucko.luckperms.common.caching.UserCache; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; @@ -90,13 +89,7 @@ public class TreeCommand extends SingleCommand { return CommandResult.STATE_ERROR; } - UserCache data = user.getUserData(); - if (data == null) { - Message.USER_NO_DATA.send(sender, user.getFriendlyName()); - return CommandResult.STATE_ERROR; - } - - PermissionData permissionData = data.getPermissionData(plugin.getContextForUser(user)); + PermissionData permissionData = user.getUserData().getPermissionData(plugin.getContextForUser(user)); TreeView view = TreeViewBuilder.newBuilder().rootPosition(selection).maxLevels(maxLevel).build(plugin.getPermissionVault()); if (!view.hasData()) { diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/user/UserInfo.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/user/UserInfo.java index b9be7a152..aacc3b013 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/user/UserInfo.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/user/UserInfo.java @@ -28,7 +28,6 @@ package me.lucko.luckperms.common.commands.impl.user; import me.lucko.luckperms.api.Contexts; import me.lucko.luckperms.api.Node; import me.lucko.luckperms.api.caching.MetaData; -import me.lucko.luckperms.api.caching.UserData; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.abstraction.SubCommand; @@ -90,28 +89,25 @@ public class UserInfo extends SubCommand { } } - UserData data = user.getUserData(); String context = "&bNone"; String prefix = "&bNone"; String suffix = "&bNone"; - if (data != null) { - Contexts contexts = plugin.getContextForUser(user); - if (contexts != null) { - context = contexts.getContexts().toSet().stream() - .map(e -> Util.contextToString(e.getKey(), e.getValue())) - .collect(Collectors.joining(" ")); + Contexts contexts = plugin.getContextForUser(user); + if (contexts != null) { + context = contexts.getContexts().toSet().stream() + .map(e -> Util.contextToString(e.getKey(), e.getValue())) + .collect(Collectors.joining(" ")); - MetaData meta = data.getMetaData(contexts); - if (meta.getPrefix() != null) { - prefix = "&f\"" + meta.getPrefix() + "&f\""; - } - if (meta.getSuffix() != null) { - suffix = "&f\"" + meta.getSuffix() + "&f\""; - } + MetaData meta = user.getUserData().getMetaData(contexts); + if (meta.getPrefix() != null) { + prefix = "&f\"" + meta.getPrefix() + "&f\""; + } + if (meta.getSuffix() != null) { + suffix = "&f\"" + meta.getSuffix() + "&f\""; } } - Message.USER_INFO_DATA.send(sender, Util.formatBoolean(data != null), context, prefix, suffix); + Message.USER_INFO_DATA.send(sender, Util.formatBoolean(contexts != null), context, prefix, suffix); return CommandResult.SUCCESS; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/constants/Message.java b/common/src/main/java/me/lucko/luckperms/common/constants/Message.java index 28527ee19..a0a8c2ddc 100644 --- a/common/src/main/java/me/lucko/luckperms/common/constants/Message.java +++ b/common/src/main/java/me/lucko/luckperms/common/constants/Message.java @@ -294,7 +294,7 @@ public enum Message { USER_INFO_DATA( "{PREFIX}&f- &aCached Data:" + "\n" + - "{PREFIX}&f- &3Is Loaded: {0}" + "\n" + + "{PREFIX}&f- &3Has contextual data: {0}" + "\n" + "{PREFIX}&f- &3Current Contexts: {1}" + "\n" + "{PREFIX}&f- &3Current Prefix: {2}" + "\n" + "{PREFIX}&f- &3Current Suffix: {3}", diff --git a/common/src/main/java/me/lucko/luckperms/common/core/model/User.java b/common/src/main/java/me/lucko/luckperms/common/core/model/User.java index d6e6e2f37..94edd6c13 100644 --- a/common/src/main/java/me/lucko/luckperms/common/core/model/User.java +++ b/common/src/main/java/me/lucko/luckperms/common/core/model/User.java @@ -29,7 +29,6 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; -import me.lucko.luckperms.api.caching.UserData; import me.lucko.luckperms.common.api.delegates.UserDelegate; import me.lucko.luckperms.common.caching.UserCache; import me.lucko.luckperms.common.caching.handlers.HolderReference; @@ -69,7 +68,7 @@ public class User extends PermissionHolder implements Identifiable refreshBuffer = new BufferedRequest(1000L, r -> getPlugin().doAsync(r)) { @@ -86,15 +85,20 @@ public class User extends PermissionHolder implements Identifiable { if (isLoaded(UserIdentifier.of(u, null))) { - SpongeUser user = get(u); - if (user.getUserData() == null) { - user.setupData(false); - } - + user.preCalculateData(false); return get(u).getSpongeData(); } @@ -101,12 +97,7 @@ public class SpongeUserManager implements UserManager, LPSubjectCollection { throw new RuntimeException(); } - user.setupData(false); - - if (user.getUserData() == null) { - getPlugin().getLog().warn("User data not present for requested user id: " + u); - } - + user.preCalculateData(false); return user.getSpongeData(); }); diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/model/SpongeUser.java b/sponge/src/main/java/me/lucko/luckperms/sponge/model/SpongeUser.java index 686228b05..d5123a97f 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/model/SpongeUser.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/model/SpongeUser.java @@ -96,13 +96,6 @@ public class SpongeUser extends User { return (now - lastUse) > 600000; } - private synchronized void checkData() { - if (parent.getUserData() == null) { - plugin.getLog().warn("User " + parent.getName().orElse("unknown") + " - " + parent.getUuid() + " does not have any data loaded."); - parent.setupData(false); - } - } - @Override public String getIdentifier() { return plugin.getUuidCache().getExternalUUID(parent.getUuid()).toString(); @@ -134,7 +127,6 @@ public class SpongeUser extends User { public Tristate getPermissionValue(ContextSet contexts, String permission) { logUsage(); try (Timing ignored = plugin.getTimings().time(LPTiming.USER_GET_PERMISSION_VALUE)) { - checkData(); return parent.getUserData().getPermissionData(plugin.getService().calculateContexts(contexts)).getPermissionValue(permission); } } @@ -153,7 +145,6 @@ public class SpongeUser extends User { try (Timing ignored = plugin.getTimings().time(LPTiming.USER_GET_PARENTS)) { ImmutableSet.Builder subjects = ImmutableSet.builder(); - checkData(); for (String perm : parent.getUserData().getPermissionData(plugin.getService().calculateContexts(contexts)).getImmutableBacking().keySet()) { if (!perm.startsWith("group.")) { continue; @@ -176,8 +167,6 @@ public class SpongeUser extends User { public Optional getOption(ContextSet contexts, String s) { logUsage(); try (Timing ignored = plugin.getTimings().time(LPTiming.USER_GET_OPTION)) { - checkData(); - MetaData data = parent.getUserData().getMetaData(plugin.getService().calculateContexts(contexts)); if (s.equalsIgnoreCase("prefix")) { if (data.getPrefix() != null) { diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsService.java b/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsService.java index 72265696e..a671de59b 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsService.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsService.java @@ -280,8 +280,6 @@ public class LuckPermsService implements PermissionService { for (User user : plugin.getUserManager().getAll().values()) { UserCache userCache = user.getUserData(); - if (userCache == null) continue; - userCache.invalidateCache(); } @@ -305,8 +303,6 @@ public class LuckPermsService implements PermissionService { for (User user : plugin.getUserManager().getAll().values()) { UserCache userCache = user.getUserData(); - if (userCache == null) continue; - userCache.invalidateCache(); } }