mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-28 20:17:55 +01:00
Rename online-mode config option to use-server-uuids to better reflect/clarify its purpose
This commit is contained in:
parent
e9e844c1f7
commit
ac4bd418f3
@ -57,6 +57,11 @@ public class BukkitConfig extends AbstractConfiguration {
|
||||
configuration = YamlConfiguration.loadConfiguration(configFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(String path) {
|
||||
return configuration.contains(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString(String path, String def) {
|
||||
return configuration.getString(path, def);
|
||||
|
@ -26,22 +26,24 @@ apply-global-groups: true
|
||||
# If users on this server should have global (non-world specific) groups applied
|
||||
apply-global-world-groups: true
|
||||
|
||||
# If this server is in offline or online mode.
|
||||
# This setting allows a player to have the same UUID across a network of offline mode/mixed servers.
|
||||
# If UUIDs should be pulled from the server, or looked up by username based upon previous connections.
|
||||
#
|
||||
# You should generally reflect the setting in server.properties here. Except when...
|
||||
# This option should be set to true in most cases. When set to false, in order to get a player's UUID, LuckPerms will:
|
||||
# 1. Check if a player with the given username has joined before, if they have, use the UUID they used on their previous login.
|
||||
# 2. Save and return the players "current" uuid.
|
||||
#
|
||||
# 1. You have Spigot servers connected to a BungeeCord proxy, with online-mode set to false, but 'bungeecord' set to true in the spigot.yml
|
||||
# AND 'ip-forward' set to true in the BungeeCord config.yml
|
||||
# In this case, set online-mode in LuckPerms to true, despite the server being in offline mode.
|
||||
# For offline mode (cracked) servers, a players UUID is generated based upon their username.
|
||||
#
|
||||
# 2. You are only running one server instance using LuckPerms, (not a network)
|
||||
# In this case, set online-mode to true no matter what is set in server.properties. (we can just fallback to the servers uuid cache)
|
||||
# IMPORTANT:
|
||||
# If you are using BungeeCord proxy running in online mode, it is important that "online-mode=false" is set in server.properties, but
|
||||
# "bungeecord: true" is set in the spigot.yml. You also need to set "ip_forward: true" in BungeeCord's config.yml.
|
||||
# If for whatever reason you are not able to do this, and do not have ip-forward enabled, then you may need to set "use-server-uuids" to false.
|
||||
#
|
||||
# 3. If your proxy is running in offline mode, and you are using PaperSpigot (https://ci.destroystokyo.com/job/PaperSpigot/),
|
||||
# you should set "bungee-online-mode" to false in the paper.yml, and set "online-mode" to true in all LuckPerms configs.
|
||||
# This approach is thoroughly recommended for offline mode networks.
|
||||
online-mode: true
|
||||
# If your proxy is running in offline mode, you should still be setting up ip-forwarding as described above, but may also find that you need to set
|
||||
# "bungee-online-mode" to false in paper.yml, if you are using PaperSpigot. (https://ci.destroystokyo.com/job/PaperSpigot/)
|
||||
#
|
||||
# This option only really exists for networks who for whatever reason cannot setup proper ip forwarding.
|
||||
use-server-uuids: true
|
||||
|
||||
# If the plugin should send log notifications to users whenever permissions are modified.
|
||||
log-notify: true
|
||||
|
@ -72,6 +72,11 @@ public class BungeeConfig extends AbstractConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(String path) {
|
||||
return configuration.contains(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString(String path, String def) {
|
||||
return configuration.getString(path, def);
|
||||
|
@ -101,7 +101,7 @@ public class BungeeListener extends AbstractListener implements Listener {
|
||||
final UuidCache cache = plugin.getUuidCache();
|
||||
final PendingConnection c = e.getConnection();
|
||||
|
||||
if (!plugin.getConfiguration().get(ConfigKeys.ONLINE_MODE)) {
|
||||
if (!plugin.getConfiguration().get(ConfigKeys.USE_SERVER_UUIDS)) {
|
||||
UUID uuid = plugin.getStorage().getUUID(c.getName()).join();
|
||||
if (uuid != null) {
|
||||
cache.addToCache(c.getUniqueId(), uuid);
|
||||
|
@ -26,22 +26,24 @@ apply-global-groups: true
|
||||
# If users on this server should have global (non-world specific) groups applied
|
||||
apply-global-world-groups: true
|
||||
|
||||
# If this server is in offline or online mode.
|
||||
# This setting allows a player to have the same UUID across a network of offline mode/mixed servers.
|
||||
# If UUIDs should be pulled from the server, or looked up by username based upon previous connections.
|
||||
#
|
||||
# You should generally reflect the setting in server.properties here. Except when...
|
||||
# This option should be set to true in most cases. When set to false, in order to get a player's UUID, LuckPerms will:
|
||||
# 1. Check if a player with the given username has joined before, if they have, use the UUID they used on their previous login.
|
||||
# 2. Save and return the players "current" uuid.
|
||||
#
|
||||
# 1. You have Spigot servers connected to a BungeeCord proxy, with online-mode set to false, but 'bungeecord' set to true in the spigot.yml
|
||||
# AND 'ip-forward' set to true in the BungeeCord config.yml
|
||||
# In this case, set online-mode in LuckPerms to true, despite the server being in offline mode.
|
||||
# For offline mode (cracked) servers, a players UUID is generated based upon their username.
|
||||
#
|
||||
# 2. You are only running one server instance using LuckPerms, (not a network)
|
||||
# In this case, set online-mode to true no matter what is set in server.properties. (we can just fallback to the servers uuid cache)
|
||||
# IMPORTANT:
|
||||
# If you are using BungeeCord proxy running in online mode, it is important that "online-mode=false" is set all backend server.properties, but
|
||||
# "bungeecord: true" is set in the spigot.yml. You also need to set "ip_forward: true" in BungeeCord's config.yml.
|
||||
# If for whatever reason you are not able to do this, and do not have ip-forward enabled, then you may need to set "use-server-uuids" to false.
|
||||
#
|
||||
# 3. If your proxy is running in offline mode, and you are using PaperSpigot (https://ci.destroystokyo.com/job/PaperSpigot/),
|
||||
# you should set "bungee-online-mode" to false in the paper.yml, and set "online-mode" to true in all LuckPerms configs.
|
||||
# This approach is thoroughly recommended for offline mode networks.
|
||||
online-mode: true
|
||||
# If your proxy is running in offline mode, you should still be setting up ip-forwarding as described above, but may also find that you need to set
|
||||
# "bungee-online-mode" to false in paper.yml, if you are using PaperSpigot. (https://ci.destroystokyo.com/job/PaperSpigot/)
|
||||
#
|
||||
# This option should always be set to true on the BungeeCord side. Don't change unless you're sure you know what you're doing.
|
||||
use-server-uuids: true
|
||||
|
||||
# If the plugin should send log notifications to users whenever permissions are modified.
|
||||
log-notify: true
|
||||
|
@ -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);
|
||||
|
@ -124,7 +124,7 @@ info: >
|
||||
{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
|
||||
|
@ -79,7 +79,7 @@ public class SpongeConfig extends AbstractConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
private ConfigurationNode getNode(String path) {
|
||||
private ConfigurationNode resolvePath(String path) {
|
||||
Iterable<String> paths = Splitter.on('.').split(path);
|
||||
ConfigurationNode node = root;
|
||||
|
||||
@ -90,24 +90,29 @@ public class SpongeConfig extends AbstractConfiguration {
|
||||
return node;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(String path) {
|
||||
return !resolvePath(path).isVirtual();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString(String path, String def) {
|
||||
return getNode(path).getString(def);
|
||||
return resolvePath(path).getString(def);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt(String path, int def) {
|
||||
return getNode(path).getInt(def);
|
||||
return resolvePath(path).getInt(def);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(String path, boolean def) {
|
||||
return getNode(path).getBoolean(def);
|
||||
return resolvePath(path).getBoolean(def);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getList(String path, List<String> def) {
|
||||
ConfigurationNode node = getNode(path);
|
||||
ConfigurationNode node = resolvePath(path);
|
||||
if (node.isVirtual()) {
|
||||
return def;
|
||||
}
|
||||
@ -117,7 +122,7 @@ public class SpongeConfig extends AbstractConfiguration {
|
||||
|
||||
@Override
|
||||
public List<String> getObjectList(String path, List<String> def) {
|
||||
ConfigurationNode node = getNode(path);
|
||||
ConfigurationNode node = resolvePath(path);
|
||||
if (node.isVirtual()) {
|
||||
return def;
|
||||
}
|
||||
@ -128,7 +133,7 @@ public class SpongeConfig extends AbstractConfiguration {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Map<String, String> getMap(String path, Map<String, String> def) {
|
||||
ConfigurationNode node = getNode(path);
|
||||
ConfigurationNode node = resolvePath(path);
|
||||
if (node.isVirtual()) {
|
||||
return def;
|
||||
}
|
||||
|
@ -26,18 +26,23 @@ apply-global-groups=true
|
||||
# If users on this server should have global (non-world specific) groups applied
|
||||
apply-global-world-groups=true
|
||||
|
||||
# If this server is in offline or online mode.
|
||||
# This setting allows a player to have the same UUID across a network of offline mode/mixed servers.
|
||||
# If UUIDs should be pulled from the server, or looked up by username based upon previous connections.
|
||||
#
|
||||
# You should generally reflect the setting in server.properties here. Except when...
|
||||
# This option should be set to true in most cases. When set to false, in order to get a player's UUID, LuckPerms will:
|
||||
# 1. Check if a player with the given username has joined before, if they have, use the UUID they used on their previous login.
|
||||
# 2. Save and return the players "current" uuid.
|
||||
#
|
||||
# 1. You have Sponge servers connected to a BungeeCord proxy, with online-mode set to false, but 'bungeecord ip-forwarding'
|
||||
# set to true in the sponge/global.conf AND 'ip-forward' set to true in the BungeeCord config.yml
|
||||
# In this case, set online-mode in LuckPerms to true, despite the server being in offline mode.
|
||||
# For offline mode (cracked) servers, a players UUID is generated based upon their username.
|
||||
#
|
||||
# 2. You are only running one server instance using LuckPerms, (not a network) In this case, set online-mode to true no
|
||||
# matter what is set in server.properties. (we can just fallback to the servers uuid cache)
|
||||
online-mode=true
|
||||
# IMPORTANT:
|
||||
# If you are using BungeeCord proxy running in online mode, it is important that "online-mode=false" is set in server.properties, but
|
||||
# "bungeecord.ip-forwarding=true" is set in Sponge's global.conf. You also need to set "ip_forward: true" in BungeeCord's config.yml.
|
||||
# If for whatever reason you are not able to do this, and do not have ip-forward enabled, then you may need to set "use-server-uuids" to false.
|
||||
#
|
||||
# If your proxy is running in offline mode, you should still be setting up ip-forwarding as described above.
|
||||
#
|
||||
# This option only really exists for networks who for whatever reason cannot setup proper ip forwarding.
|
||||
use-server-uuids=true
|
||||
|
||||
# If the plugin should send log notifications to users whenever permissions are modified.
|
||||
log-notify=true
|
||||
|
Loading…
Reference in New Issue
Block a user