Rename online-mode config option to use-server-uuids to better reflect/clarify its purpose
This commit is contained in:
+1
-1
@@ -70,7 +70,7 @@ public class LPConfigurationDelegate implements LPConfiguration {
|
||||
|
||||
@Override
|
||||
public boolean getOnlineMode() {
|
||||
return master.get(ConfigKeys.ONLINE_MODE);
|
||||
return master.get(ConfigKeys.USE_SERVER_UUIDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -77,7 +77,7 @@ public class InfoCommand extends SingleCommand {
|
||||
plugin.getPreProcessContexts(false).size(),
|
||||
plugin.getContextManager().getCalculatorsSize(),
|
||||
plugin.getPermissionVault().getSize(),
|
||||
formatBoolean(c.get(ConfigKeys.ONLINE_MODE)),
|
||||
formatBoolean(c.get(ConfigKeys.USE_SERVER_UUIDS)),
|
||||
formatBoolean(c.get(ConfigKeys.INCLUDING_GLOBAL_PERMS)),
|
||||
formatBoolean(c.get(ConfigKeys.INCLUDING_GLOBAL_WORLD_PERMS)),
|
||||
formatBoolean(c.get(ConfigKeys.APPLYING_GLOBAL_GROUPS)),
|
||||
|
||||
@@ -58,7 +58,10 @@ public class ConfigKeys {
|
||||
public static final ConfigKey<Boolean> INCLUDING_GLOBAL_WORLD_PERMS = BooleanKey.of("include-global-world", true);
|
||||
public static final ConfigKey<Boolean> APPLYING_GLOBAL_GROUPS = BooleanKey.of("apply-global-groups", true);
|
||||
public static final ConfigKey<Boolean> APPLYING_GLOBAL_WORLD_GROUPS = BooleanKey.of("apply-global-world-groups", true);
|
||||
public static final ConfigKey<Boolean> ONLINE_MODE = BooleanKey.of("online-mode", true);
|
||||
public static final ConfigKey<Boolean> USE_SERVER_UUIDS = AbstractKey.of(c -> {
|
||||
// backwards compatible with the old online-mode option
|
||||
return c.contains("use-server-uuids") ? c.getBoolean("use-server-uuids", true) : c.getBoolean("online-mode", true);
|
||||
});
|
||||
public static final ConfigKey<TemporaryModifier> TEMPORARY_ADD_BEHAVIOUR = AbstractKey.of(c -> {
|
||||
String option = c.getString("temporary-add-behaviour", "deny").toLowerCase();
|
||||
if (!option.equals("deny") && !option.equals("replace") && !option.equals("accumulate")) {
|
||||
|
||||
@@ -40,6 +40,8 @@ public interface LuckPermsConfiguration {
|
||||
|
||||
void loadAll();
|
||||
|
||||
boolean contains(String path);
|
||||
|
||||
String getString(String path, String def);
|
||||
|
||||
int getInt(String path, int def);
|
||||
|
||||
@@ -170,7 +170,7 @@ public enum Message {
|
||||
"{PREFIX}&f- &3Context Calculators: &a{14}" + "\n" +
|
||||
"{PREFIX}&f- &3Unique permissions: &a{15}" + "\n" +
|
||||
"{PREFIX}&f- &bConfiguration:" + "\n" +
|
||||
"{PREFIX}&f- &3Online Mode: {16}" + "\n" +
|
||||
"{PREFIX}&f- &3Use Server UUIDs: {16}" + "\n" +
|
||||
"{PREFIX}&f- &bPermission Calculation:" + "\n" +
|
||||
"{PREFIX}&f- &3Including Global: {17}" + "\n" +
|
||||
"{PREFIX}&f- &3Including Global World: {18}" + "\n" +
|
||||
|
||||
@@ -49,25 +49,25 @@ public class UuidCache {
|
||||
private final UuidCacheDelegate delegate = new UuidCacheDelegate(this);
|
||||
|
||||
public UUID getUUID(UUID external) {
|
||||
return plugin.getConfiguration().get(ConfigKeys.ONLINE_MODE) ? external : cache.getOrDefault(external, external);
|
||||
return plugin.getConfiguration().get(ConfigKeys.USE_SERVER_UUIDS) ? external : cache.getOrDefault(external, external);
|
||||
}
|
||||
|
||||
public UUID getExternalUUID(UUID internal) {
|
||||
return plugin.getConfiguration().get(ConfigKeys.ONLINE_MODE) ? internal : cache.inverse().getOrDefault(internal, internal);
|
||||
return plugin.getConfiguration().get(ConfigKeys.USE_SERVER_UUIDS) ? internal : cache.inverse().getOrDefault(internal, internal);
|
||||
}
|
||||
|
||||
public void addToCache(UUID external, UUID internal) {
|
||||
if (plugin.getConfiguration().get(ConfigKeys.ONLINE_MODE)) return;
|
||||
if (plugin.getConfiguration().get(ConfigKeys.USE_SERVER_UUIDS)) return;
|
||||
cache.forcePut(external, internal);
|
||||
}
|
||||
|
||||
public void clearCache(UUID external) {
|
||||
if (plugin.getConfiguration().get(ConfigKeys.ONLINE_MODE)) return;
|
||||
if (plugin.getConfiguration().get(ConfigKeys.USE_SERVER_UUIDS)) return;
|
||||
cache.remove(external);
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return plugin.getConfiguration().get(ConfigKeys.ONLINE_MODE) ? 0 : cache.size();
|
||||
return plugin.getConfiguration().get(ConfigKeys.USE_SERVER_UUIDS) ? 0 : cache.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class AbstractListener {
|
||||
final long startTime = System.currentTimeMillis();
|
||||
|
||||
final UuidCache cache = plugin.getUuidCache();
|
||||
if (!plugin.getConfiguration().get(ConfigKeys.ONLINE_MODE)) {
|
||||
if (!plugin.getConfiguration().get(ConfigKeys.USE_SERVER_UUIDS)) {
|
||||
UUID uuid = plugin.getStorage().force().getUUID(username).join();
|
||||
if (uuid != null) {
|
||||
cache.addToCache(u, uuid);
|
||||
|
||||
Reference in New Issue
Block a user