diff --git a/bukkit/src/main/java/me/lucko/luckperms/BukkitConfig.java b/bukkit/src/main/java/me/lucko/luckperms/BukkitConfig.java index 873dd9b66..5c5113fe2 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/BukkitConfig.java +++ b/bukkit/src/main/java/me/lucko/luckperms/BukkitConfig.java @@ -22,14 +22,17 @@ package me.lucko.luckperms; -import me.lucko.luckperms.core.LPConfiguration; +import me.lucko.luckperms.core.AbstractConfiguration; +import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; import java.io.File; import java.io.IOException; +import java.util.HashMap; +import java.util.Map; -class BukkitConfig extends LPConfiguration { +class BukkitConfig extends AbstractConfiguration { private YamlConfiguration configuration; BukkitConfig(LPBukkitPlugin plugin) { @@ -55,11 +58,6 @@ class BukkitConfig extends LPConfiguration { } } - @Override - protected void set(String path, Object value) { - configuration.set(path, value); - } - @Override protected String getString(String path, String def) { return configuration.getString(path, def); @@ -74,4 +72,20 @@ class BukkitConfig extends LPConfiguration { protected boolean getBoolean(String path, boolean def) { return configuration.getBoolean(path, def); } + + @SuppressWarnings("unchecked") + @Override + protected Map getMap(String path, Map def) { + Map map = new HashMap<>(); + ConfigurationSection section = configuration.getConfigurationSection(path); + if (section == null) { + return def; + } + + for (String key : section.getKeys(false)) { + map.put(key, section.getString(key)); + } + + return map; + } } diff --git a/bukkit/src/main/java/me/lucko/luckperms/BukkitListener.java b/bukkit/src/main/java/me/lucko/luckperms/BukkitListener.java index 10dd62dd7..bd89b14ea 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/BukkitListener.java +++ b/bukkit/src/main/java/me/lucko/luckperms/BukkitListener.java @@ -104,7 +104,7 @@ class BukkitListener extends AbstractListener implements Listener { @EventHandler public void onPlayerCommand(PlayerCommandPreprocessEvent e) { - if (plugin.getConfiguration().getEnableOps()) { + if (plugin.getConfiguration().isOpsEnabled()) { return; } diff --git a/bukkit/src/main/java/me/lucko/luckperms/LPBukkitPlugin.java b/bukkit/src/main/java/me/lucko/luckperms/LPBukkitPlugin.java index 73d3fd1ac..a65c4859f 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/LPBukkitPlugin.java +++ b/bukkit/src/main/java/me/lucko/luckperms/LPBukkitPlugin.java @@ -95,7 +95,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { datastore = StorageFactory.getDatastore(this, "h2"); getLog().info("Loading internal permission managers..."); - uuidCache = new UuidCache(getConfiguration().getOnlineMode()); + uuidCache = new UuidCache(getConfiguration().isOnlineMode()); userManager = new BukkitUserManager(this); groupManager = new GroupManager(this); trackManager = new TrackManager(); @@ -139,8 +139,8 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { e.printStackTrace(); } - registerPermissions(getConfiguration().getCommandsAllowOp() ? PermissionDefault.OP : PermissionDefault.FALSE); - if (!getConfiguration().getEnableOps()) { + registerPermissions(getConfiguration().isCommandsAllowOp() ? PermissionDefault.OP : PermissionDefault.FALSE); + if (!getConfiguration().isOpsEnabled()) { getServer().getOperators().forEach(o -> o.setOp(false)); } diff --git a/bukkit/src/main/java/me/lucko/luckperms/api/vault/VaultHook.java b/bukkit/src/main/java/me/lucko/luckperms/api/vault/VaultHook.java index d9d12e830..ee5e88c02 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/api/vault/VaultHook.java +++ b/bukkit/src/main/java/me/lucko/luckperms/api/vault/VaultHook.java @@ -40,7 +40,7 @@ public class VaultHook { } permissionHook.setPlugin(plugin); permissionHook.setServer(plugin.getConfiguration().getVaultServer()); - permissionHook.setIncludeGlobal(plugin.getConfiguration().getVaultIncludeGlobal()); + permissionHook.setIncludeGlobal(plugin.getConfiguration().isVaultIncludingGlobal()); if (chatHook == null) { chatHook = new VaultChatHook(permissionHook); diff --git a/bukkit/src/main/java/me/lucko/luckperms/inject/LPPermissible.java b/bukkit/src/main/java/me/lucko/luckperms/inject/LPPermissible.java index 078a6a3c2..139abd5de 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/inject/LPPermissible.java +++ b/bukkit/src/main/java/me/lucko/luckperms/inject/LPPermissible.java @@ -62,15 +62,15 @@ public class LPPermissible extends PermissibleBase { List processors = new ArrayList<>(5); processors.add(new PermissionCalculator.MapProcessor(luckPermsPermissions)); processors.add(new AttachmentProcessor(attachmentPermissions)); - if (plugin.getConfiguration().getApplyWildcards()) { + if (plugin.getConfiguration().isApplyingWildcards()) { processors.add(new PermissionCalculator.WildcardProcessor(luckPermsPermissions)); } - if (plugin.getConfiguration().getApplyRegex()) { + if (plugin.getConfiguration().isApplyingRegex()) { processors.add(new PermissionCalculator.RegexProcessor(luckPermsPermissions)); } processors.add(new BukkitDefaultsProcessor(parent::isOp, defaultsProvider)); - calculator = new PermissionCalculator(plugin, parent.getName(), plugin.getConfiguration().getDebugPermissionChecks(), processors); + calculator = new PermissionCalculator(plugin, parent.getName(), plugin.getConfiguration().isDebugPermissionChecks(), processors); recalculatePermissions(); } diff --git a/bukkit/src/main/java/me/lucko/luckperms/users/BukkitUser.java b/bukkit/src/main/java/me/lucko/luckperms/users/BukkitUser.java index 6f910100c..32e798cef 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/users/BukkitUser.java +++ b/bukkit/src/main/java/me/lucko/luckperms/users/BukkitUser.java @@ -60,16 +60,17 @@ public class BukkitUser extends User { } // Calculate the permissions that should be applied. This is done async, who cares about how long it takes or how often it's done. + String world = plugin.getUserManager().getWorldCache().get(getUuid()); Map toApply = exportNodes( new Contexts( getPlugin().getConfiguration().getServer(), - plugin.getUserManager().getWorldCache().get(getUuid()), + getPlugin().getConfiguration().getWorldRewrites().getOrDefault(world, world), null, - getPlugin().getConfiguration().getIncludeGlobalPerms(), - getPlugin().getConfiguration().getIncludeGlobalWorldPerms(), + getPlugin().getConfiguration().isIncludingGlobalPerms(), + getPlugin().getConfiguration().isIncludingGlobalWorldPerms(), true, - getPlugin().getConfiguration().getApplyGlobalGroups(), - getPlugin().getConfiguration().getApplyGlobalWorldGroups() + getPlugin().getConfiguration().isApplyingGlobalGroups(), + getPlugin().getConfiguration().isApplyingGlobalWorldGroups() ), Collections.emptyList() ); @@ -96,7 +97,7 @@ public class BukkitUser extends User { lpPermissible.invalidateCache(); existing.putAll(toApply); - if (plugin.getConfiguration().getAutoOp()) { + if (plugin.getConfiguration().isAutoOp()) { boolean op = false; for (Map.Entry e : toApply.entrySet()) { diff --git a/bukkit/src/main/java/me/lucko/luckperms/users/BukkitUserManager.java b/bukkit/src/main/java/me/lucko/luckperms/users/BukkitUserManager.java index cf42e6ad4..d5d449a28 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/users/BukkitUserManager.java +++ b/bukkit/src/main/java/me/lucko/luckperms/users/BukkitUserManager.java @@ -55,7 +55,7 @@ public class BukkitUserManager extends UserManager { u.setLpPermissible(null); } - if (plugin.getConfiguration().getAutoOp()) { + if (plugin.getConfiguration().isAutoOp()) { player.setOp(false); } } diff --git a/bukkit/src/main/resources/config.yml b/bukkit/src/main/resources/config.yml index beb4b2f36..1a29d26cb 100644 --- a/bukkit/src/main/resources/config.yml +++ b/bukkit/src/main/resources/config.yml @@ -80,6 +80,16 @@ vault-server: global # If global permissions should be considered when retrieving meta or player groups vault-include-global: true +# Mirrors world names. Whenever LuckPerms checks what world a user is in, if the world name is in this list, the value assigned +# will be sent forward for permission calculation instead. +world-rewrite: + #world_nether: world + #world_the_end: world + +# Rewrites group names. The underlying name of the group does not change, just the output in commands / placeholders / Vault. +group-name-rewrite: + #default: Member + # Which storage method the plugin should use. # Currently supported: mysql, sqlite, h2, json, yaml, mongodb # Fill out connection info below if you're using MySQL or MongoDB diff --git a/bungee/src/main/java/me/lucko/luckperms/BungeeConfig.java b/bungee/src/main/java/me/lucko/luckperms/BungeeConfig.java index 349cd9855..7651df7b4 100644 --- a/bungee/src/main/java/me/lucko/luckperms/BungeeConfig.java +++ b/bungee/src/main/java/me/lucko/luckperms/BungeeConfig.java @@ -22,7 +22,7 @@ package me.lucko.luckperms; -import me.lucko.luckperms.core.LPConfiguration; +import me.lucko.luckperms.core.AbstractConfiguration; import net.md_5.bungee.config.Configuration; import net.md_5.bungee.config.ConfigurationProvider; import net.md_5.bungee.config.YamlConfiguration; @@ -31,8 +31,9 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; +import java.util.Map; -class BungeeConfig extends LPConfiguration { +class BungeeConfig extends AbstractConfiguration { private Configuration configuration; BungeeConfig(LPBungeePlugin plugin) { @@ -62,11 +63,6 @@ class BungeeConfig extends LPConfiguration { } } - @Override - protected void set(String path, Object value) { - configuration.set(path, value); - } - @Override protected String getString(String path, String def) { return configuration.getString(path, def); @@ -81,4 +77,9 @@ class BungeeConfig extends LPConfiguration { protected boolean getBoolean(String path, boolean def) { return configuration.getBoolean(path, def); } + + @Override + protected Map getMap(String path, Map def) { + return configuration.get(path, def); + } } diff --git a/bungee/src/main/java/me/lucko/luckperms/BungeePlayerCache.java b/bungee/src/main/java/me/lucko/luckperms/BungeePlayerCache.java index 01c376e17..d123076bc 100644 --- a/bungee/src/main/java/me/lucko/luckperms/BungeePlayerCache.java +++ b/bungee/src/main/java/me/lucko/luckperms/BungeePlayerCache.java @@ -41,14 +41,14 @@ public class BungeePlayerCache { public BungeePlayerCache(LuckPermsPlugin plugin, String name) { List processors = new ArrayList<>(3); processors.add(new PermissionCalculator.MapProcessor(permissions)); - if (plugin.getConfiguration().getApplyWildcards()) { + if (plugin.getConfiguration().isApplyingWildcards()) { processors.add(new PermissionCalculator.WildcardProcessor(permissions)); } - if (plugin.getConfiguration().getApplyRegex()) { + if (plugin.getConfiguration().isApplyingRegex()) { processors.add(new PermissionCalculator.RegexProcessor(permissions)); } - calculator = new PermissionCalculator(plugin, name, plugin.getConfiguration().getDebugPermissionChecks(), processors); + calculator = new PermissionCalculator(plugin, name, plugin.getConfiguration().isDebugPermissionChecks(), processors); } public void invalidateCache() { diff --git a/bungee/src/main/java/me/lucko/luckperms/LPBungeePlugin.java b/bungee/src/main/java/me/lucko/luckperms/LPBungeePlugin.java index 828f4c298..0e06178ff 100644 --- a/bungee/src/main/java/me/lucko/luckperms/LPBungeePlugin.java +++ b/bungee/src/main/java/me/lucko/luckperms/LPBungeePlugin.java @@ -88,7 +88,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin { datastore = StorageFactory.getDatastore(this, "h2"); getLog().info("Loading internal permission managers..."); - uuidCache = new UuidCache(getConfiguration().getOnlineMode()); + uuidCache = new UuidCache(getConfiguration().isOnlineMode()); userManager = new BungeeUserManager(this); groupManager = new GroupManager(this); trackManager = new TrackManager(); diff --git a/bungee/src/main/java/me/lucko/luckperms/users/BungeeUser.java b/bungee/src/main/java/me/lucko/luckperms/users/BungeeUser.java index 09c90c04c..e67fedf7c 100644 --- a/bungee/src/main/java/me/lucko/luckperms/users/BungeeUser.java +++ b/bungee/src/main/java/me/lucko/luckperms/users/BungeeUser.java @@ -64,13 +64,13 @@ public class BungeeUser extends User { Map toApply = exportNodes( new Contexts( plugin.getConfiguration().getServer(), - server, + plugin.getConfiguration().getWorldRewrites().getOrDefault(server, server), null, - plugin.getConfiguration().getIncludeGlobalPerms(), - plugin.getConfiguration().getIncludeGlobalWorldPerms(), + plugin.getConfiguration().isIncludingGlobalPerms(), + plugin.getConfiguration().isIncludingGlobalWorldPerms(), true, - plugin.getConfiguration().getApplyGlobalGroups(), - plugin.getConfiguration().getApplyGlobalWorldGroups() + plugin.getConfiguration().isApplyingGlobalGroups(), + plugin.getConfiguration().isApplyingGlobalWorldGroups() ), Collections.emptyList() ); diff --git a/bungee/src/main/resources/config.yml b/bungee/src/main/resources/config.yml index 754328840..52adb7cdd 100644 --- a/bungee/src/main/resources/config.yml +++ b/bungee/src/main/resources/config.yml @@ -59,6 +59,18 @@ log-notify: true # If LuckPerms should print to console every time a plugin checks if a player has a permission debug-permission-checks: false +# Mirrors world names. Whenever LuckPerms checks what world a user is in, if the world name is in this list, the value assigned +# will be sent forward for permission calculation instead. +# Remember world names on BungeeCord relate to the backend server name a user is connected to. +world-rewrite: + #hub2: hub + #hub3: hub + #opfactions: factions + +# Rewrites group names. The underlying name of the group does not change, just the output in commands / placeholders / Vault. +group-name-rewrite: + #default: Member + # Which storage method the plugin should use. # Currently supported: mysql, sqlite, h2, json, yaml, mongodb # Fill out connection info below if you're using MySQL or MongoDB diff --git a/common/src/main/java/me/lucko/luckperms/api/implementation/internal/LPConfigurationLink.java b/common/src/main/java/me/lucko/luckperms/api/implementation/internal/LPConfigurationLink.java index 6072a603d..34af6efca 100644 --- a/common/src/main/java/me/lucko/luckperms/api/implementation/internal/LPConfigurationLink.java +++ b/common/src/main/java/me/lucko/luckperms/api/implementation/internal/LPConfigurationLink.java @@ -58,67 +58,67 @@ public class LPConfigurationLink implements LPConfiguration { @Override public boolean getIncludeGlobalPerms() { - return master.getIncludeGlobalPerms(); + return master.isIncludingGlobalPerms(); } @Override public boolean getIncludeGlobalWorldPerms() { - return master.getIncludeGlobalWorldPerms(); + return master.isIncludingGlobalWorldPerms(); } @Override public boolean getApplyGlobalGroups() { - return master.getApplyGlobalGroups(); + return master.isApplyingGlobalGroups(); } @Override public boolean getApplyGlobalWorldGroups() { - return master.getApplyGlobalWorldGroups(); + return master.isApplyingGlobalWorldGroups(); } @Override public boolean getOnlineMode() { - return master.getOnlineMode(); + return master.isOnlineMode(); } @Override public boolean getApplyWildcards() { - return master.getApplyWildcards(); + return master.isApplyingWildcards(); } @Override public boolean getApplyRegex() { - return master.getApplyRegex(); + return master.isApplyingRegex(); } @Override public boolean getApplyShorthand() { - return master.getApplyShorthand(); + return master.isApplyingShorthand(); } @Override public boolean getLogNotify() { - return master.getLogNotify(); + return master.isLogNotify(); } @Override public boolean getDebugPermissionChecks() { - return master.getDebugPermissionChecks(); + return master.isDebugPermissionChecks(); } @Override public boolean getEnableOps() { - return master.getEnableOps(); + return master.isOpsEnabled(); } @Override public boolean getCommandsAllowOp() { - return master.getCommandsAllowOp(); + return master.isCommandsAllowOp(); } @Override public boolean getAutoOp() { - return master.getAutoOp(); + return master.isAutoOp(); } @Override @@ -128,7 +128,7 @@ public class LPConfigurationLink implements LPConfiguration { @Override public boolean getVaultIncludeGlobal() { - return master.getVaultIncludeGlobal(); + return master.isVaultIncludingGlobal(); } @SuppressWarnings("deprecation") @@ -149,10 +149,9 @@ public class LPConfigurationLink implements LPConfiguration { @Override public boolean getSplitStorage() { - return master.getSplitStorage(); + return master.isSplitStorage(); } - @SuppressWarnings("unchecked") @Override public Map getSplitStorageOptions() { return master.getSplitStorageOptions(); diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/DeleteGroup.java b/common/src/main/java/me/lucko/luckperms/commands/group/DeleteGroup.java index b40383ae2..8baaa2c02 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/DeleteGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/DeleteGroup.java @@ -71,7 +71,7 @@ public class DeleteGroup extends SingleMainCommand { return CommandResult.FAILURE; } - Message.DELETE_SUCCESS.send(sender, groupName); + Message.DELETE_SUCCESS.send(sender, group.getDisplayName()); LogEntry.build().actor(sender).actedName(groupName).type('G').action("delete").build().submit(plugin, sender); plugin.runUpdateTask(); return CommandResult.SUCCESS; diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/ListGroups.java b/common/src/main/java/me/lucko/luckperms/commands/group/ListGroups.java index d7b2f66f5..d5b95c071 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/ListGroups.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/ListGroups.java @@ -29,9 +29,11 @@ import me.lucko.luckperms.commands.SingleMainCommand; import me.lucko.luckperms.commands.Util; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; +import me.lucko.luckperms.groups.Group; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; public class ListGroups extends SingleMainCommand { public ListGroups() { @@ -45,7 +47,13 @@ public class ListGroups extends SingleMainCommand { return CommandResult.LOADING_ERROR; } - Message.GROUPS_LIST.send(sender, Util.listToCommaSep(new ArrayList<>(plugin.getGroupManager().getAll().keySet()))); + Message.GROUPS_LIST.send( + sender, + Util.listToCommaSep(new ArrayList<>(plugin.getGroupManager().getAll().values().stream() + .map(Group::getDisplayName) + .collect(Collectors.toList())) + ) + ); return CommandResult.SUCCESS; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddPrefix.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddPrefix.java index d7872e46a..d6b916c4b 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddPrefix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddPrefix.java @@ -65,14 +65,14 @@ public class GroupAddPrefix extends SubCommand { if (args.size() == 3) { group.setPermission(node, true, server); - Message.ADDPREFIX_SERVER_SUCCESS.send(sender, group.getName(), prefix, priority, server); + Message.ADDPREFIX_SERVER_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, server); LogEntry.build().actor(sender).acted(group) .action("addprefix " + priority + " " + args.get(1) + " " + server) .build().submit(plugin, sender); } else { final String world = args.get(3).toLowerCase(); group.setPermission(node, true, server, world); - Message.ADDPREFIX_SERVER_WORLD_SUCCESS.send(sender, group.getName(), prefix, priority, server, world); + Message.ADDPREFIX_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, server, world); LogEntry.build().actor(sender).acted(group) .action("addprefix " + priority + " " + args.get(1) + " " + server + " " + world) .build().submit(plugin, sender); @@ -80,7 +80,7 @@ public class GroupAddPrefix extends SubCommand { } else { group.setPermission(node, true); - Message.ADDPREFIX_SUCCESS.send(sender, group.getName(), prefix, priority); + Message.ADDPREFIX_SUCCESS.send(sender, group.getDisplayName(), prefix, priority); LogEntry.build().actor(sender).acted(group) .action("addprefix " + priority + " " + args.get(1)) .build().submit(plugin, sender); @@ -89,7 +89,7 @@ public class GroupAddPrefix extends SubCommand { save(group, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectAlreadyHasException e) { - Message.ALREADY_HAS_PREFIX.send(sender, group.getName()); + Message.ALREADY_HAS_PREFIX.send(sender, group.getDisplayName()); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddSuffix.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddSuffix.java index ceb7a4b42..c818e3d62 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddSuffix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddSuffix.java @@ -65,14 +65,14 @@ public class GroupAddSuffix extends SubCommand { if (args.size() == 3) { group.setPermission(node, true, server); - Message.ADDSUFFIX_SERVER_SUCCESS.send(sender, group.getName(), suffix, priority, server); + Message.ADDSUFFIX_SERVER_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, server); LogEntry.build().actor(sender).acted(group) .action("addsuffix " + priority + " " + args.get(1) + " " + server) .build().submit(plugin, sender); } else { final String world = args.get(3).toLowerCase(); group.setPermission(node, true, server, world); - Message.ADDSUFFIX_SERVER_WORLD_SUCCESS.send(sender, group.getName(), suffix, priority, server, world); + Message.ADDSUFFIX_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, server, world); LogEntry.build().actor(sender).acted(group) .action("addsuffix " + priority + " " + args.get(1) + " " + server + " " + world) .build().submit(plugin, sender); @@ -80,7 +80,7 @@ public class GroupAddSuffix extends SubCommand { } else { group.setPermission(node, true); - Message.ADDSUFFIX_SUCCESS.send(sender, group.getName(), suffix, priority); + Message.ADDSUFFIX_SUCCESS.send(sender, group.getDisplayName(), suffix, priority); LogEntry.build().actor(sender).acted(group) .action("addsuffix " + priority + " " + args.get(1)) .build().submit(plugin, sender); @@ -89,7 +89,7 @@ public class GroupAddSuffix extends SubCommand { save(group, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectAlreadyHasException e) { - Message.ALREADY_HAS_SUFFIX.send(sender, group.getName()); + Message.ALREADY_HAS_SUFFIX.send(sender, group.getDisplayName()); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddTempPrefix.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddTempPrefix.java index 1ba000de3..c0943b3ad 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddTempPrefix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddTempPrefix.java @@ -83,14 +83,14 @@ public class GroupAddTempPrefix extends SubCommand { if (args.size() == 4) { group.setPermission(node, true, server, duration); - Message.ADD_TEMP_PREFIX_SERVER_SUCCESS.send(sender, group.getName(), prefix, priority, server, DateUtil.formatDateDiff(duration)); + Message.ADD_TEMP_PREFIX_SERVER_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, server, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("addtempprefix " + priority + " " + args.get(1) + " " + duration + " " + server) .build().submit(plugin, sender); } else { final String world = args.get(4).toLowerCase(); group.setPermission(node, true, server, world, duration); - Message.ADD_TEMP_PREFIX_SERVER_WORLD_SUCCESS.send(sender, group.getName(), prefix, priority, server, world, DateUtil.formatDateDiff(duration)); + Message.ADD_TEMP_PREFIX_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, server, world, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("addtempprefix " + priority + " " + args.get(1) + " " + duration + " " + server + " " + world) .build().submit(plugin, sender); @@ -98,7 +98,7 @@ public class GroupAddTempPrefix extends SubCommand { } else { group.setPermission(node, true, duration); - Message.ADD_TEMP_PREFIX_SUCCESS.send(sender, group.getName(), prefix, priority, DateUtil.formatDateDiff(duration)); + Message.ADD_TEMP_PREFIX_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("addtempprefix " + priority + " " + args.get(1) + " " + duration) .build().submit(plugin, sender); @@ -107,7 +107,7 @@ public class GroupAddTempPrefix extends SubCommand { save(group, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectAlreadyHasException e) { - Message.ALREADY_HAS_PREFIX.send(sender, group.getName()); + Message.ALREADY_HAS_PREFIX.send(sender, group.getDisplayName()); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddTempSuffix.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddTempSuffix.java index 1b4f4b4df..c6c7b7d9b 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddTempSuffix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddTempSuffix.java @@ -83,14 +83,14 @@ public class GroupAddTempSuffix extends SubCommand { if (args.size() == 4) { group.setPermission(node, true, server, duration); - Message.ADD_TEMP_SUFFIX_SERVER_SUCCESS.send(sender, group.getName(), suffix, priority, server, DateUtil.formatDateDiff(duration)); + Message.ADD_TEMP_SUFFIX_SERVER_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, server, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("addtempsuffix " + priority + " " + args.get(1) + " " + duration + " " + server) .build().submit(plugin, sender); } else { final String world = args.get(4).toLowerCase(); group.setPermission(node, true, server, world, duration); - Message.ADD_TEMP_SUFFIX_SERVER_WORLD_SUCCESS.send(sender, group.getName(), suffix, priority, server, world, DateUtil.formatDateDiff(duration)); + Message.ADD_TEMP_SUFFIX_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, server, world, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("addtempsuffix " + priority + " " + args.get(1) + " " + duration + " " + server + " " + world) .build().submit(plugin, sender); @@ -98,7 +98,7 @@ public class GroupAddTempSuffix extends SubCommand { } else { group.setPermission(node, true, duration); - Message.ADD_TEMP_SUFFIX_SUCCESS.send(sender, group.getName(), suffix, priority, DateUtil.formatDateDiff(duration)); + Message.ADD_TEMP_SUFFIX_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("addtempsuffix " + priority + " " + args.get(1) + " " + duration) .build().submit(plugin, sender); @@ -107,7 +107,7 @@ public class GroupAddTempSuffix extends SubCommand { save(group, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectAlreadyHasException e) { - Message.ALREADY_HAS_SUFFIX.send(sender, group.getName()); + Message.ALREADY_HAS_SUFFIX.send(sender, group.getDisplayName()); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupChatMeta.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupChatMeta.java index cef6a637b..d3ab07d9d 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupChatMeta.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupChatMeta.java @@ -68,18 +68,18 @@ public class GroupChatMeta extends SubCommand { } if (prefixes.isEmpty()) { - Message.CHAT_META_PREFIX_NONE.send(sender, group.getName()); + Message.CHAT_META_PREFIX_NONE.send(sender, group.getDisplayName()); } else { - Message.CHAT_META_PREFIX_HEADER.send(sender, group.getName()); + Message.CHAT_META_PREFIX_HEADER.send(sender, group.getDisplayName()); for (Map.Entry e : prefixes) { Message.CHAT_META_ENTRY.send(sender, e.getKey(), e.getValue()); } } if (suffixes.isEmpty()) { - Message.CHAT_META_SUFFIX_NONE.send(sender, group.getName()); + Message.CHAT_META_SUFFIX_NONE.send(sender, group.getDisplayName()); } else { - Message.CHAT_META_SUFFIX_HEADER.send(sender, group.getName()); + Message.CHAT_META_SUFFIX_HEADER.send(sender, group.getDisplayName()); for (Map.Entry e : suffixes) { Message.CHAT_META_ENTRY.send(sender, e.getKey(), e.getValue()); } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupClear.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupClear.java index 9682d873a..a3f357508 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupClear.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupClear.java @@ -43,7 +43,7 @@ public class GroupClear extends SubCommand { @Override public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group group, List args, String label) { group.clearNodes(); - Message.CLEAR_SUCCESS.send(sender, group.getName()); + Message.CLEAR_SUCCESS.send(sender, group.getDisplayName()); LogEntry.build().actor(sender).acted(group).action("clear").build().submit(plugin, sender); save(group, sender, plugin); return CommandResult.SUCCESS; diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInfo.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInfo.java index 8da31ef54..e0b0fc435 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInfo.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInfo.java @@ -42,12 +42,13 @@ public class GroupInfo extends SubCommand { @Override public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group group, List args, String label) { Message.GROUP_INFO.send(sender, - group.getName(), + group.getDisplayName(), group.getPermanentNodes().size(), group.getTemporaryNodes().size(), label, group.getName() ); + // TODO show inheritances return CommandResult.SUCCESS; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupListNodes.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupListNodes.java index 11707b4d6..d653ab3a6 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupListNodes.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupListNodes.java @@ -38,8 +38,8 @@ public class GroupListNodes extends SubCommand { @Override public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group group, List args, String label) { - Message.LISTNODES.send(sender, group.getName(), Util.permNodesToString(group.getPermissions(false))); - Message.LISTNODES_TEMP.send(sender, group.getName(), Util.tempNodesToString(group.getPermissions(false))); + Message.LISTNODES.send(sender, group.getDisplayName(), Util.permNodesToString(group.getPermissions(false))); + Message.LISTNODES_TEMP.send(sender, group.getDisplayName(), Util.tempNodesToString(group.getPermissions(false))); return CommandResult.SUCCESS; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemovePrefix.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemovePrefix.java index 90e9a8297..368c59f04 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemovePrefix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemovePrefix.java @@ -65,14 +65,14 @@ public class GroupRemovePrefix extends SubCommand { if (args.size() == 3) { group.unsetPermission(node, server); - Message.REMOVEPREFIX_SERVER_SUCCESS.send(sender, group.getName(), prefix, priority, server); + Message.REMOVEPREFIX_SERVER_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, server); LogEntry.build().actor(sender).acted(group) .action("removeprefix " + priority + " " + args.get(1) + " " + server) .build().submit(plugin, sender); } else { final String world = args.get(3).toLowerCase(); group.unsetPermission(node, server, world); - Message.REMOVEPREFIX_SERVER_WORLD_SUCCESS.send(sender, group.getName(), prefix, priority, server, world); + Message.REMOVEPREFIX_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, server, world); LogEntry.build().actor(sender).acted(group) .action("removeprefix " + priority + " " + args.get(1) + " " + server + " " + world) .build().submit(plugin, sender); @@ -80,7 +80,7 @@ public class GroupRemovePrefix extends SubCommand { } else { group.unsetPermission(node); - Message.REMOVEPREFIX_SUCCESS.send(sender, group.getName(), prefix, priority); + Message.REMOVEPREFIX_SUCCESS.send(sender, group.getDisplayName(), prefix, priority); LogEntry.build().actor(sender).acted(group) .action("removeprefix " + priority + " " + args.get(1)) .build().submit(plugin, sender); @@ -89,7 +89,7 @@ public class GroupRemovePrefix extends SubCommand { save(group, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectLacksException e) { - Message.DOES_NOT_HAVE_PREFIX.send(sender, group.getName()); + Message.DOES_NOT_HAVE_PREFIX.send(sender, group.getDisplayName()); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveSuffix.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveSuffix.java index 9df9202c1..36f88130d 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveSuffix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveSuffix.java @@ -65,14 +65,14 @@ public class GroupRemoveSuffix extends SubCommand { if (args.size() == 3) { group.unsetPermission(node, server); - Message.REMOVESUFFIX_SERVER_SUCCESS.send(sender, group.getName(), suffix, priority, server); + Message.REMOVESUFFIX_SERVER_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, server); LogEntry.build().actor(sender).acted(group) .action("removesuffix " + priority + " " + args.get(1) + " " + server) .build().submit(plugin, sender); } else { final String world = args.get(3).toLowerCase(); group.unsetPermission(node, server, world); - Message.REMOVESUFFIX_SERVER_WORLD_SUCCESS.send(sender, group.getName(), suffix, priority, server, world); + Message.REMOVESUFFIX_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, server, world); LogEntry.build().actor(sender).acted(group) .action("removesuffix " + priority + " " + args.get(1) + " " + server + " " + world) .build().submit(plugin, sender); @@ -80,7 +80,7 @@ public class GroupRemoveSuffix extends SubCommand { } else { group.unsetPermission(node); - Message.REMOVESUFFIX_SUCCESS.send(sender, group.getName(), suffix, priority); + Message.REMOVESUFFIX_SUCCESS.send(sender, group.getDisplayName(), suffix, priority); LogEntry.build().actor(sender).acted(group) .action("removesuffix " + priority + " " + args.get(1)) .build().submit(plugin, sender); @@ -89,7 +89,7 @@ public class GroupRemoveSuffix extends SubCommand { save(group, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectLacksException e) { - Message.DOES_NOT_HAVE_SUFFIX.send(sender, group.getName()); + Message.DOES_NOT_HAVE_SUFFIX.send(sender, group.getDisplayName()); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveTempPrefix.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveTempPrefix.java index 1740a95d2..2efd839bb 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveTempPrefix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveTempPrefix.java @@ -65,14 +65,14 @@ public class GroupRemoveTempPrefix extends SubCommand { if (args.size() == 3) { group.unsetPermission(node, server, true); - Message.REMOVE_TEMP_PREFIX_SERVER_SUCCESS.send(sender, group.getName(), prefix, priority, server); + Message.REMOVE_TEMP_PREFIX_SERVER_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, server); LogEntry.build().actor(sender).acted(group) .action("removetempprefix " + priority + " " + args.get(1) + " " + server) .build().submit(plugin, sender); } else { final String world = args.get(3).toLowerCase(); group.unsetPermission(node, server, world, true); - Message.REMOVE_TEMP_PREFIX_SERVER_WORLD_SUCCESS.send(sender, group.getName(), prefix, priority, server, world); + Message.REMOVE_TEMP_PREFIX_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, server, world); LogEntry.build().actor(sender).acted(group) .action("removetempprefix " + priority + " " + args.get(1) + " " + server + " " + world) .build().submit(plugin, sender); @@ -80,7 +80,7 @@ public class GroupRemoveTempPrefix extends SubCommand { } else { group.unsetPermission(node, true); - Message.REMOVE_TEMP_PREFIX_SUCCESS.send(sender, group.getName(), prefix, priority); + Message.REMOVE_TEMP_PREFIX_SUCCESS.send(sender, group.getDisplayName(), prefix, priority); LogEntry.build().actor(sender).acted(group) .action("removetempprefix " + priority + " " + args.get(1)) .build().submit(plugin, sender); @@ -89,7 +89,7 @@ public class GroupRemoveTempPrefix extends SubCommand { save(group, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectLacksException e) { - Message.DOES_NOT_HAVE_PREFIX.send(sender, group.getName()); + Message.DOES_NOT_HAVE_PREFIX.send(sender, group.getDisplayName()); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveTempSuffix.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveTempSuffix.java index 01f1775b7..95454bf7f 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveTempSuffix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveTempSuffix.java @@ -65,14 +65,14 @@ public class GroupRemoveTempSuffix extends SubCommand { if (args.size() == 3) { group.unsetPermission(node, server, true); - Message.REMOVE_TEMP_SUFFIX_SERVER_SUCCESS.send(sender, group.getName(), suffix, priority, server); + Message.REMOVE_TEMP_SUFFIX_SERVER_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, server); LogEntry.build().actor(sender).acted(group) .action("removetempsuffix " + priority + " " + args.get(1) + " " + server) .build().submit(plugin, sender); } else { final String world = args.get(3).toLowerCase(); group.unsetPermission(node, server, world, true); - Message.REMOVE_TEMP_SUFFIX_SERVER_WORLD_SUCCESS.send(sender, group.getName(), suffix, priority, server, world); + Message.REMOVE_TEMP_SUFFIX_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, server, world); LogEntry.build().actor(sender).acted(group) .action("removetempsuffix " + priority + " " + args.get(1) + " " + server + " " + world) .build().submit(plugin, sender); @@ -80,7 +80,7 @@ public class GroupRemoveTempSuffix extends SubCommand { } else { group.unsetPermission(node, true); - Message.REMOVE_TEMP_SUFFIX_SUCCESS.send(sender, group.getName(), suffix, priority); + Message.REMOVE_TEMP_SUFFIX_SUCCESS.send(sender, group.getDisplayName(), suffix, priority); LogEntry.build().actor(sender).acted(group) .action("removetempsuffix " + priority + " " + args.get(1)) .build().submit(plugin, sender); @@ -89,7 +89,7 @@ public class GroupRemoveTempSuffix extends SubCommand { save(group, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectLacksException e) { - Message.DOES_NOT_HAVE_SUFFIX.send(sender, group.getName()); + Message.DOES_NOT_HAVE_SUFFIX.send(sender, group.getDisplayName()); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetInherit.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetInherit.java index fc5071502..3c151f08f 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetInherit.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetInherit.java @@ -73,14 +73,14 @@ public class GroupSetInherit extends SubCommand { if (args.size() == 2) { group.setInheritGroup(group1, server); - Message.GROUP_SETINHERIT_SERVER_SUCCESS.send(sender, group.getName(), group1.getName(), server); + Message.GROUP_SETINHERIT_SERVER_SUCCESS.send(sender, group.getDisplayName(), group1.getDisplayName(), server); LogEntry.build().actor(sender).acted(group) .action("setinherit " + group1.getName() + " " + server) .build().submit(plugin, sender); } else { final String world = args.get(2).toLowerCase(); group.setInheritGroup(group1, server, world); - Message.GROUP_SETINHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getName(), group1.getName(), server, world); + Message.GROUP_SETINHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), group1.getDisplayName(), server, world); LogEntry.build().actor(sender).acted(group) .action("setinherit " + group1.getName() + " " + server + " " + world) .build().submit(plugin, sender); @@ -88,7 +88,7 @@ public class GroupSetInherit extends SubCommand { } else { group.setInheritGroup(group1); - Message.GROUP_SETINHERIT_SUCCESS.send(sender, group.getName(), group1.getName()); + Message.GROUP_SETINHERIT_SUCCESS.send(sender, group.getDisplayName(), group1.getDisplayName()); LogEntry.build().actor(sender).acted(group) .action("setinherit " + group1.getName()) .build().submit(plugin, sender); @@ -97,7 +97,7 @@ public class GroupSetInherit extends SubCommand { save(group, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectAlreadyHasException e) { - Message.GROUP_ALREADY_INHERITS.send(sender, group.getName(), group1.getName()); + Message.GROUP_ALREADY_INHERITS.send(sender, group.getDisplayName(), group1.getDisplayName()); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetPermission.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetPermission.java index 9d6e3cf4f..c75efe9f4 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetPermission.java @@ -74,14 +74,14 @@ public class GroupSetPermission extends SubCommand { if (args.size() == 3) { group.setPermission(node, b, server); - Message.SETPERMISSION_SERVER_SUCCESS.send(sender, node, bool, group.getName(), server); + Message.SETPERMISSION_SERVER_SUCCESS.send(sender, node, bool, group.getDisplayName(), server); LogEntry.build().actor(sender).acted(group) .action("set " + node + " " + b + " " + server) .build().submit(plugin, sender); } else { final String world = args.get(3).toLowerCase(); group.setPermission(node, b, server, world); - Message.SETPERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, bool, group.getName(), server, world); + Message.SETPERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, bool, group.getDisplayName(), server, world); LogEntry.build().actor(sender).acted(group) .action("set " + node + " " + b + " " + server + " " + world) .build().submit(plugin, sender); @@ -89,7 +89,7 @@ public class GroupSetPermission extends SubCommand { } else { group.setPermission(node, b); - Message.SETPERMISSION_SUCCESS.send(sender, node, bool, group.getName()); + Message.SETPERMISSION_SUCCESS.send(sender, node, bool, group.getDisplayName()); LogEntry.build().actor(sender).acted(group) .action("set " + node + " " + b) .build().submit(plugin, sender); @@ -98,7 +98,7 @@ public class GroupSetPermission extends SubCommand { save(group, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectAlreadyHasException e) { - Message.ALREADY_HASPERMISSION.send(sender, group.getName()); + Message.ALREADY_HASPERMISSION.send(sender, group.getDisplayName()); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempInherit.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempInherit.java index bad0f4336..2c4e48172 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempInherit.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempInherit.java @@ -91,7 +91,7 @@ public class GroupSetTempInherit extends SubCommand { if (args.size() == 3) { group.setInheritGroup(group1, server, duration); - Message.GROUP_SET_TEMP_INHERIT_SERVER_SUCCESS.send(sender, group.getName(), group1.getName(), server, + Message.GROUP_SET_TEMP_INHERIT_SERVER_SUCCESS.send(sender, group.getDisplayName(), group1.getDisplayName(), server, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("settempinherit " + group1.getName() + " " + duration + " " + server) @@ -99,7 +99,7 @@ public class GroupSetTempInherit extends SubCommand { } else { final String world = args.get(3).toLowerCase(); group.setInheritGroup(group1, server, world, duration); - Message.GROUP_SET_TEMP_INHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getName(), group1.getName(), server, + Message.GROUP_SET_TEMP_INHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), group1.getDisplayName(), server, world, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("settempinherit " + group1.getName() + " " + duration + " " + server + " " + world) @@ -108,7 +108,7 @@ public class GroupSetTempInherit extends SubCommand { } else { group.setInheritGroup(group1, duration); - Message.GROUP_SET_TEMP_INHERIT_SUCCESS.send(sender, group.getName(), group1.getName(), DateUtil.formatDateDiff(duration)); + Message.GROUP_SET_TEMP_INHERIT_SUCCESS.send(sender, group.getDisplayName(), group1.getDisplayName(), DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("settempinherit " + group1.getName() + " " + duration) .build().submit(plugin, sender); @@ -117,7 +117,7 @@ public class GroupSetTempInherit extends SubCommand { save(group, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectAlreadyHasException e) { - Message.USER_ALREADY_TEMP_MEMBER_OF.send(sender, group.getName(), group1.getName()); + Message.USER_ALREADY_TEMP_MEMBER_OF.send(sender, group.getDisplayName(), group1.getDisplayName()); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempPermission.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempPermission.java index 227828302..6dfe81c12 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempPermission.java @@ -93,7 +93,7 @@ public class GroupSetTempPermission extends SubCommand { if (args.size() == 4) { group.setPermission(node, b, server, duration); - Message.SETPERMISSION_TEMP_SERVER_SUCCESS.send(sender, node, bool, group.getName(), server, + Message.SETPERMISSION_TEMP_SERVER_SUCCESS.send(sender, node, bool, group.getDisplayName(), server, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("settemp " + node + " " + b + " " + duration + " " + server) @@ -101,7 +101,7 @@ public class GroupSetTempPermission extends SubCommand { } else { final String world = args.get(4).toLowerCase(); group.setPermission(node, b, server, world, duration); - Message.SETPERMISSION_TEMP_SERVER_WORLD_SUCCESS.send(sender, node, bool, group.getName(), server, + Message.SETPERMISSION_TEMP_SERVER_WORLD_SUCCESS.send(sender, node, bool, group.getDisplayName(), server, world, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("settemp " + node + " " + b + " " + duration + " " + server + " " + world) @@ -110,7 +110,7 @@ public class GroupSetTempPermission extends SubCommand { } else { group.setPermission(node, b, duration); - Message.SETPERMISSION_TEMP_SUCCESS.send(sender, node, bool, group.getName(), DateUtil.formatDateDiff(duration)); + Message.SETPERMISSION_TEMP_SUCCESS.send(sender, node, bool, group.getDisplayName(), DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("settemp " + node + " " + b + " " + duration) .build().submit(plugin, sender); @@ -119,7 +119,7 @@ public class GroupSetTempPermission extends SubCommand { save(group, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectAlreadyHasException e) { - Message.ALREADY_HAS_TEMP_PERMISSION.send(sender, group.getName()); + Message.ALREADY_HAS_TEMP_PERMISSION.send(sender, group.getDisplayName()); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnSetPermission.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnSetPermission.java index eed487b95..7b44299b0 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnSetPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnSetPermission.java @@ -66,14 +66,14 @@ public class GroupUnSetPermission extends SubCommand { if (args.size() == 2) { group.unsetPermission(node, server); - Message.UNSETPERMISSION_SERVER_SUCCESS.send(sender, node, group.getName(), server); + Message.UNSETPERMISSION_SERVER_SUCCESS.send(sender, node, group.getDisplayName(), server); LogEntry.build().actor(sender).acted(group) .action("unset " + node + " " + server) .build().submit(plugin, sender); } else { final String world = args.get(2).toLowerCase(); group.unsetPermission(node, server, world); - Message.UNSETPERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, group.getName(), server, world); + Message.UNSETPERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, group.getDisplayName(), server, world); LogEntry.build().actor(sender).acted(group) .action("unset " + node + " " + server + " " + world) .build().submit(plugin, sender); @@ -81,7 +81,7 @@ public class GroupUnSetPermission extends SubCommand { } else { group.unsetPermission(node); - Message.UNSETPERMISSION_SUCCESS.send(sender, node, group.getName()); + Message.UNSETPERMISSION_SUCCESS.send(sender, node, group.getDisplayName()); LogEntry.build().actor(sender).acted(group) .action("unset " + node) .build().submit(plugin, sender); @@ -90,7 +90,7 @@ public class GroupUnSetPermission extends SubCommand { save(group, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectLacksException e) { - Message.DOES_NOT_HAVEPERMISSION.send(sender, group.getName()); + Message.DOES_NOT_HAVEPERMISSION.send(sender, group.getDisplayName()); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetInherit.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetInherit.java index 8ea0b790e..5d38976ff 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetInherit.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetInherit.java @@ -62,14 +62,14 @@ public class GroupUnsetInherit extends SubCommand { if (args.size() == 2) { group.unsetPermission("group." + groupName, server); - Message.GROUP_UNSETINHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server); + Message.GROUP_UNSETINHERIT_SERVER_SUCCESS.send(sender, group.getDisplayName(), groupName, server); LogEntry.build().actor(sender).acted(group) .action("unsetinherit " + groupName + " " + server) .build().submit(plugin, sender); } else { final String world = args.get(2).toLowerCase(); group.unsetPermission("group." + groupName, server, world); - Message.GROUP_UNSETINHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getName(), groupName, server, world); + Message.GROUP_UNSETINHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), groupName, server, world); LogEntry.build().actor(sender).acted(group) .action("unsetinherit " + groupName + " " + server + " " + world) .build().submit(plugin, sender); @@ -77,7 +77,7 @@ public class GroupUnsetInherit extends SubCommand { } else { group.unsetPermission("group." + groupName); - Message.GROUP_UNSETINHERIT_SUCCESS.send(sender, group.getName(), groupName); + Message.GROUP_UNSETINHERIT_SUCCESS.send(sender, group.getDisplayName(), groupName); LogEntry.build().actor(sender).acted(group) .action("unsetinherit " + groupName) .build().submit(plugin, sender); @@ -86,7 +86,7 @@ public class GroupUnsetInherit extends SubCommand { save(group, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectLacksException e) { - Message.GROUP_DOES_NOT_INHERIT.send(sender, group.getName(), groupName); + Message.GROUP_DOES_NOT_INHERIT.send(sender, group.getDisplayName(), groupName); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempInherit.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempInherit.java index 82afead4b..ee44f9864 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempInherit.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempInherit.java @@ -62,14 +62,14 @@ public class GroupUnsetTempInherit extends SubCommand { if (args.size() == 2) { group.unsetPermission("group." + groupName, server, true); - Message.GROUP_UNSET_TEMP_INHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server); + Message.GROUP_UNSET_TEMP_INHERIT_SERVER_SUCCESS.send(sender, group.getDisplayName(), groupName, server); LogEntry.build().actor(sender).acted(group) .action("unsettempinherit " + groupName + " " + server) .build().submit(plugin, sender); } else { final String world = args.get(2).toLowerCase(); group.unsetPermission("group." + groupName, server, world, true); - Message.GROUP_UNSET_TEMP_INHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getName(), groupName, server, world); + Message.GROUP_UNSET_TEMP_INHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), groupName, server, world); LogEntry.build().actor(sender).acted(group) .action("unsettempinherit " + groupName + " " + server + " " + world) .build().submit(plugin, sender); @@ -77,7 +77,7 @@ public class GroupUnsetTempInherit extends SubCommand { } else { group.unsetPermission("group." + groupName, true); - Message.GROUP_UNSET_TEMP_INHERIT_SUCCESS.send(sender, group.getName(), groupName); + Message.GROUP_UNSET_TEMP_INHERIT_SUCCESS.send(sender, group.getDisplayName(), groupName); LogEntry.build().actor(sender).acted(group) .action("unsettempinherit " + groupName) .build().submit(plugin, sender); @@ -86,7 +86,7 @@ public class GroupUnsetTempInherit extends SubCommand { save(group, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectLacksException e) { - Message.GROUP_DOES_NOT_TEMP_INHERIT.send(sender, group.getName(), groupName); + Message.GROUP_DOES_NOT_TEMP_INHERIT.send(sender, group.getDisplayName(), groupName); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempPermission.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempPermission.java index 75c85c051..ec1ca4532 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempPermission.java @@ -67,14 +67,14 @@ public class GroupUnsetTempPermission extends SubCommand { if (args.size() == 2) { group.unsetPermission(node, server); - Message.UNSET_TEMP_PERMISSION_SERVER_SUCCESS.send(sender, node, group.getName(), server); + Message.UNSET_TEMP_PERMISSION_SERVER_SUCCESS.send(sender, node, group.getDisplayName(), server); LogEntry.build().actor(sender).acted(group) .action("unsettemp " + node + " " + server) .build().submit(plugin, sender); } else { final String world = args.get(2).toLowerCase(); group.unsetPermission(node, server, world); - Message.UNSET_TEMP_PERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, group.getName(), server, world); + Message.UNSET_TEMP_PERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, group.getDisplayName(), server, world); LogEntry.build().actor(sender).acted(group) .action("unsettemp " + node + " " + server + " " + world) .build().submit(plugin, sender); @@ -82,7 +82,7 @@ public class GroupUnsetTempPermission extends SubCommand { } else { group.unsetPermission(node, true); - Message.UNSET_TEMP_PERMISSION_SUCCESS.send(sender, node, group.getName()); + Message.UNSET_TEMP_PERMISSION_SUCCESS.send(sender, node, group.getDisplayName()); LogEntry.build().actor(sender).acted(group) .action("unsettemp " + node) .build().submit(plugin, sender); @@ -91,7 +91,7 @@ public class GroupUnsetTempPermission extends SubCommand { save(group, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectLacksException e) { - Message.DOES_NOT_HAVE_TEMP_PERMISSION.send(sender, group.getName()); + Message.DOES_NOT_HAVE_TEMP_PERMISSION.send(sender, group.getDisplayName()); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/misc/InfoCommand.java b/common/src/main/java/me/lucko/luckperms/commands/misc/InfoCommand.java index d711bbf5e..3cca41477 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/misc/InfoCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/misc/InfoCommand.java @@ -48,14 +48,14 @@ public class InfoCommand extends SingleMainCommand { plugin.getDatastore().getName(), c.getServer(), c.getSyncTime(), - formatBoolean(c.getIncludeGlobalPerms()), - formatBoolean(c.getIncludeGlobalWorldPerms()), - formatBoolean(c.getApplyGlobalGroups()), - formatBoolean(c.getApplyGlobalWorldGroups()), - formatBoolean(c.getOnlineMode()), - formatBoolean(c.getApplyWildcards()), - formatBoolean(c.getApplyRegex()), - formatBoolean(c.getApplyShorthand()) + formatBoolean(c.isIncludingGlobalPerms()), + formatBoolean(c.isIncludingGlobalWorldPerms()), + formatBoolean(c.isApplyingGlobalGroups()), + formatBoolean(c.isApplyingGlobalWorldGroups()), + formatBoolean(c.isOnlineMode()), + formatBoolean(c.isApplyingWildcards()), + formatBoolean(c.isApplyingRegex()), + formatBoolean(c.isApplyingShorthand()) ); return CommandResult.SUCCESS; diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddGroup.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddGroup.java index 8766aae6e..ff74ed433 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddGroup.java @@ -73,14 +73,14 @@ public class UserAddGroup extends SubCommand { if (args.size() == 2) { user.addGroup(group, server); - Message.USER_ADDGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server); + Message.USER_ADDGROUP_SERVER_SUCCESS.send(sender, user.getName(), group.getDisplayName(), server); LogEntry.build().actor(sender).acted(user) .action("addgroup " + group.getName() + " " + server) .build().submit(plugin, sender); } else { final String world = args.get(2).toLowerCase(); user.addGroup(group, server, world); - Message.USER_ADDGROUP_SERVER_WORLD_SUCCESS.send(sender, user.getName(), groupName, server, world); + Message.USER_ADDGROUP_SERVER_WORLD_SUCCESS.send(sender, user.getName(), group.getDisplayName(), server, world); LogEntry.build().actor(sender).acted(user) .action("addgroup " + group.getName() + " " + server + " " + world) .build().submit(plugin, sender); @@ -88,7 +88,7 @@ public class UserAddGroup extends SubCommand { } else { user.addGroup(group); - Message.USER_ADDGROUP_SUCCESS.send(sender, user.getName(), groupName); + Message.USER_ADDGROUP_SUCCESS.send(sender, user.getName(), group.getDisplayName()); LogEntry.build().actor(sender).acted(user) .action("addgroup " + group.getName()) .build().submit(plugin, sender); @@ -97,7 +97,7 @@ public class UserAddGroup extends SubCommand { save(user, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectAlreadyHasException e) { - Message.USER_ALREADY_MEMBER_OF.send(sender, user.getName(), group.getName()); + Message.USER_ALREADY_MEMBER_OF.send(sender, user.getName(), group.getDisplayName()); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempGroup.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempGroup.java index d2300804b..d0f69142f 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempGroup.java @@ -92,7 +92,7 @@ public class UserAddTempGroup extends SubCommand { if (args.size() == 3) { user.addGroup(group, server, duration); - Message.USER_ADDTEMPGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server, + Message.USER_ADDTEMPGROUP_SERVER_SUCCESS.send(sender, user.getName(), group.getDisplayName(), server, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(user) .action("addtempgroup " + group.getName() + " " + duration + " " + server) @@ -100,7 +100,7 @@ public class UserAddTempGroup extends SubCommand { } else { final String world = args.get(3).toLowerCase(); user.addGroup(group, server, world, duration); - Message.USER_ADDTEMPGROUP_SERVER_WORLD_SUCCESS.send(sender, user.getName(), groupName, server, + Message.USER_ADDTEMPGROUP_SERVER_WORLD_SUCCESS.send(sender, user.getName(), group.getDisplayName(), server, world, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(user) .action("addtempgroup " + group.getName() + " " + duration + " " + server + " " + world) @@ -109,7 +109,7 @@ public class UserAddTempGroup extends SubCommand { } else { user.addGroup(group, duration); - Message.USER_ADDTEMPGROUP_SUCCESS.send(sender, user.getName(), groupName, DateUtil.formatDateDiff(duration)); + Message.USER_ADDTEMPGROUP_SUCCESS.send(sender, user.getName(), group.getDisplayName(), DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(user) .action("addtempgroup " + group.getName() + " " + duration) .build().submit(plugin, sender); @@ -118,7 +118,7 @@ public class UserAddTempGroup extends SubCommand { save(user, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectAlreadyHasException e) { - Message.USER_ALREADY_TEMP_MEMBER_OF.send(sender, user.getName(), group.getName()); + Message.USER_ALREADY_TEMP_MEMBER_OF.send(sender, user.getName(), group.getDisplayName()); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserDemote.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserDemote.java index 4eeb04e61..c31cf950a 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserDemote.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserDemote.java @@ -103,9 +103,9 @@ public class UserDemote extends SubCommand { } catch (ObjectAlreadyHasException ignored) {} user.setPrimaryGroup(previousGroup.getName()); - Message.USER_DEMOTE_SUCCESS_PROMOTE.send(sender, track.getName(), old, previousGroup.getName()); - Message.USER_DEMOTE_SUCCESS_REMOVE.send(sender, user.getName(), old, previousGroup.getName(), previousGroup.getName()); - Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), previousGroup.getName(), old, true)); + Message.USER_DEMOTE_SUCCESS_PROMOTE.send(sender, track.getName(), old, previousGroup.getDisplayName()); + Message.USER_DEMOTE_SUCCESS_REMOVE.send(sender, user.getName(), old, previousGroup.getDisplayName(), previousGroup.getDisplayName()); + Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), previousGroup.getDisplayName(), old, true)); LogEntry.build().actor(sender).acted(user) .action("demote " + track.getName() + "(from " + old + " to " + previousGroup.getName() + ")") .build().submit(plugin, sender); diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInfo.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInfo.java index b692abc62..96cd90584 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInfo.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInfo.java @@ -41,7 +41,7 @@ public class UserInfo extends SubCommand { user.getName(), user.getUuid(), plugin.getPlayerStatus(user.getUuid()), - Util.listToCommaSep(user.getGroupNames()), + Util.listToCommaSep(user.getGroupNames()), // TODO move this to own command user.getPrimaryGroup(), user.getPermanentNodes().size(), user.getTemporaryNodes().size(), diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserPromote.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserPromote.java index 7839463a8..549edd165 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserPromote.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserPromote.java @@ -103,9 +103,9 @@ public class UserPromote extends SubCommand { } catch (ObjectAlreadyHasException ignored) {} user.setPrimaryGroup(nextGroup.getName()); - Message.USER_PROMOTE_SUCCESS_PROMOTE.send(sender, track.getName(), old, nextGroup.getName()); - Message.USER_PROMOTE_SUCCESS_REMOVE.send(sender, user.getName(), old, nextGroup.getName(), nextGroup.getName()); - Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), old, nextGroup.getName(), false)); + Message.USER_PROMOTE_SUCCESS_PROMOTE.send(sender, track.getName(), old, nextGroup.getDisplayName()); + Message.USER_PROMOTE_SUCCESS_REMOVE.send(sender, user.getName(), old, nextGroup.getDisplayName(), nextGroup.getDisplayName()); + Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), old, nextGroup.getDisplayName(), false)); LogEntry.build().actor(sender).acted(user) .action("promote " + track.getName() + "(from " + old + " to " + nextGroup.getName() + ")") .build().submit(plugin, sender); diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPrimaryGroup.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPrimaryGroup.java index fafe2acc2..5e88ea5d8 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPrimaryGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPrimaryGroup.java @@ -63,7 +63,7 @@ public class UserSetPrimaryGroup extends SubCommand { } user.setPrimaryGroup(group.getName()); - Message.USER_PRIMARYGROUP_SUCCESS.send(sender, user.getName(), group.getName()); + Message.USER_PRIMARYGROUP_SUCCESS.send(sender, user.getName(), group.getDisplayName()); LogEntry.build().actor(sender).acted(user) .action("setprimarygroup " + group.getName()) .build().submit(plugin, sender); diff --git a/common/src/main/java/me/lucko/luckperms/core/AbstractConfiguration.java b/common/src/main/java/me/lucko/luckperms/core/AbstractConfiguration.java new file mode 100644 index 000000000..bd567688a --- /dev/null +++ b/common/src/main/java/me/lucko/luckperms/core/AbstractConfiguration.java @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2016 Lucko (Luck) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.lucko.luckperms.core; + +import com.google.common.collect.ImmutableMap; +import lombok.AccessLevel; +import lombok.Getter; +import me.lucko.luckperms.LuckPermsPlugin; +import me.lucko.luckperms.constants.Patterns; +import me.lucko.luckperms.storage.DatastoreConfiguration; + +import java.util.Collections; +import java.util.Map; + +/** + * A thread-safe config abstraction + * @param the plugin type + */ +@Getter +public abstract class AbstractConfiguration implements LPConfiguration { + + @Getter(AccessLevel.PROTECTED) + private final T plugin; + + // Values + private String server; + private int syncTime; + private String defaultGroupNode; + private String defaultGroupName; + private boolean includingGlobalPerms; + private boolean includingGlobalWorldPerms; + private boolean applyingGlobalGroups; + private boolean applyingGlobalWorldGroups; + private boolean onlineMode; + private boolean applyingWildcards; + private boolean applyingRegex; + private boolean applyingShorthand; + private boolean logNotify; + private boolean debugPermissionChecks; + private boolean opsEnabled; + private boolean commandsAllowOp; + private boolean autoOp; + private String vaultServer; + private boolean vaultIncludingGlobal; + private Map worldRewrites; + private Map groupNameRewrites; + private DatastoreConfiguration databaseValues; + private String storageMethod; + private boolean splitStorage; + private Map splitStorageOptions; + + public AbstractConfiguration(T plugin, String defaultServerName, boolean defaultIncludeGlobal, String defaultStorage) { + this.plugin = plugin; + init(); + load(defaultServerName, defaultIncludeGlobal, defaultStorage); + } + + protected abstract void init(); + protected abstract String getString(String path, String def); + protected abstract int getInt(String path, int def); + protected abstract boolean getBoolean(String path, boolean def); + protected abstract Map getMap(String path, Map def); + + public void load(String defaultServerName, boolean defaultIncludeGlobal, String defaultStorage) { + server = getString("server", defaultServerName); + syncTime = getInt("data.sync-minutes", 3); + defaultGroupNode = "group.default"; // constant since 2.6 + defaultGroupName = "default"; // constant since 2.6 + includingGlobalPerms = getBoolean("include-global", defaultIncludeGlobal); + includingGlobalWorldPerms = getBoolean("include-global-world", true); + applyingGlobalGroups = getBoolean("apply-global-groups", true); + applyingGlobalWorldGroups = getBoolean("apply-global-world-groups", true); + onlineMode = getBoolean("online-mode", true); + applyingWildcards = getBoolean("apply-wildcards", true); + applyingRegex = getBoolean("apply-regex", true); + applyingShorthand = getBoolean("apply-shorthand", true); + logNotify = getBoolean("log-notify", true); + debugPermissionChecks = getBoolean("debug-permission-checks", false); + autoOp = getBoolean("auto-op", false); + opsEnabled = !isAutoOp() && getBoolean("enable-ops", true); + commandsAllowOp = getBoolean("commands-allow-op", true); + vaultServer = getString("vault-server", "global"); + vaultIncludingGlobal = getBoolean("vault-include-global", true); + worldRewrites = ImmutableMap.copyOf(getMap("world-rewrite", Collections.emptyMap())); + groupNameRewrites = ImmutableMap.copyOf(getMap("group-name-rewrite", Collections.emptyMap())); + databaseValues = new DatastoreConfiguration( + getString("data.address", null), + getString("data.database", null), + getString("data.username", null), + getString("data.password", null) + ); + storageMethod = getString("storage-method", defaultStorage); + splitStorage = getBoolean("split-storage.enabled", false); + splitStorageOptions = ImmutableMap.builder() + .put("user", getString("split-storage.methods.user", defaultStorage)) + .put("group", getString("split-storage.methods.group", defaultStorage)) + .put("track", getString("split-storage.methods.track", defaultStorage)) + .put("uuid", getString("split-storage.methods.uuid", defaultStorage)) + .put("log", getString("split-storage.methods.log", defaultStorage)) + .build(); + + if (Patterns.NON_ALPHA_NUMERIC.matcher(getServer()).find()) { + plugin.getLog().severe("Server name defined in config.yml contains invalid characters. Server names can " + + "only contain alphanumeric characters.\nDefined server name '" + getServer() + "' will be replaced with '" + + defaultServerName + "' (the default)"); + server = defaultServerName; + } + } +} diff --git a/common/src/main/java/me/lucko/luckperms/core/LPConfiguration.java b/common/src/main/java/me/lucko/luckperms/core/LPConfiguration.java index 54034dd21..264e8cb5c 100644 --- a/common/src/main/java/me/lucko/luckperms/core/LPConfiguration.java +++ b/common/src/main/java/me/lucko/luckperms/core/LPConfiguration.java @@ -22,156 +22,68 @@ package me.lucko.luckperms.core; -import lombok.AccessLevel; -import lombok.Getter; -import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.constants.Patterns; import me.lucko.luckperms.storage.DatastoreConfiguration; -import java.util.HashMap; import java.util.Map; -public abstract class LPConfiguration { +public interface LPConfiguration { - @Getter(AccessLevel.PROTECTED) - private final T plugin; + String getServer(); - private final String defaultServerName; - private final boolean defaultIncludeGlobal; - private final String defaultStorage; - - public LPConfiguration(T plugin, String defaultServerName, boolean defaultIncludeGlobal, String defaultStorage) { - this.plugin = plugin; - this.defaultServerName = defaultServerName; - this.defaultIncludeGlobal = defaultIncludeGlobal; - this.defaultStorage = defaultStorage; - init(); - - if (Patterns.NON_ALPHA_NUMERIC.matcher(getServer()).find()) { - plugin.getLog().severe("Server name defined in config.yml contains invalid characters. Server names can " + - "only contain alphanumeric characters.\nDefined server name '" + getServer() + "' will be replaced with '" + - defaultServerName + "' (the default)"); - set("server", defaultServerName); - } - } - - protected abstract void init(); - protected abstract void set(String path, Object value); - protected abstract String getString(String path, String def); - protected abstract int getInt(String path, int def); - protected abstract boolean getBoolean(String path, boolean def); - - public String getServer() { - return getString("server", defaultServerName); - } - - public int getSyncTime() { - return getInt("data.sync-minutes", 3); - } + int getSyncTime(); /** * As of 2.6, this value is a constant * @return the default group node */ - @SuppressWarnings("SameReturnValue") - public String getDefaultGroupNode() { - return "group.default"; - } + String getDefaultGroupNode(); /** * As of 2.6, this value is a constant * @return the name of the default group */ - @SuppressWarnings("SameReturnValue") - public String getDefaultGroupName() { - return "default"; - } + String getDefaultGroupName(); - public boolean getIncludeGlobalPerms() { - return getBoolean("include-global", defaultIncludeGlobal); - } + boolean isIncludingGlobalPerms(); - public boolean getIncludeGlobalWorldPerms() { - return getBoolean("include-global-world", true); - } + boolean isIncludingGlobalWorldPerms(); - public boolean getApplyGlobalGroups() { - return getBoolean("apply-global-groups", true); - } + boolean isApplyingGlobalGroups(); - public boolean getApplyGlobalWorldGroups() { - return getBoolean("apply-global-world-groups", true); - } + boolean isApplyingGlobalWorldGroups(); - public boolean getOnlineMode() { - return getBoolean("online-mode", true); - } + boolean isOnlineMode(); - public boolean getApplyWildcards() { - return getBoolean("apply-wildcards", true); - } + boolean isApplyingWildcards(); - public boolean getApplyRegex() { - return getBoolean("apply-regex", true); - } + boolean isApplyingRegex(); - public boolean getApplyShorthand() { - return getBoolean("apply-shorthand", true); - } + boolean isApplyingShorthand(); - public boolean getLogNotify() { - return getBoolean("log-notify", true); - } + boolean isLogNotify(); - public boolean getDebugPermissionChecks() { - return getBoolean("debug-permission-checks", false); - } + boolean isDebugPermissionChecks(); - public boolean getEnableOps() { - return !getAutoOp() && getBoolean("enable-ops", true); - } + boolean isOpsEnabled(); - public boolean getCommandsAllowOp() { - return getBoolean("commands-allow-op", true); - } + boolean isCommandsAllowOp(); - public boolean getAutoOp() { - return getBoolean("auto-op", false); - } + boolean isAutoOp(); - public String getVaultServer() { - return getString("vault-server", "global"); - } + String getVaultServer(); - public boolean getVaultIncludeGlobal() { - return getBoolean("vault-include-global", true); - } + boolean isVaultIncludingGlobal(); - public DatastoreConfiguration getDatabaseValues() { - return new DatastoreConfiguration( - getString("data.address", null), - getString("data.database", null), - getString("data.username", null), - getString("data.password", null) - ); - } + Map getWorldRewrites(); - public String getStorageMethod() { - return getString("storage-method", defaultStorage); - } + Map getGroupNameRewrites(); - public boolean getSplitStorage() { - return getBoolean("split-storage.enabled", false); - } + DatastoreConfiguration getDatabaseValues(); - public Map getSplitStorageOptions() { - Map map = new HashMap<>(); - map.put("user", getString("split-storage.methods.user", defaultStorage)); - map.put("group", getString("split-storage.methods.group", defaultStorage)); - map.put("track", getString("split-storage.methods.track", defaultStorage)); - map.put("uuid", getString("split-storage.methods.uuid", defaultStorage)); - map.put("log", getString("split-storage.methods.log", defaultStorage)); + String getStorageMethod(); + + boolean isSplitStorage(); + + Map getSplitStorageOptions(); - return map; - } } diff --git a/common/src/main/java/me/lucko/luckperms/core/PermissionHolder.java b/common/src/main/java/me/lucko/luckperms/core/PermissionHolder.java index 3be2184dd..052519c50 100644 --- a/common/src/main/java/me/lucko/luckperms/core/PermissionHolder.java +++ b/common/src/main/java/me/lucko/luckperms/core/PermissionHolder.java @@ -161,12 +161,12 @@ public abstract class PermissionHolder { while (iterator.hasNext()) { Node node = iterator.next(); - if (!node.shouldApplyOnServer(context.getServer(), context.isApplyGlobalGroups(), plugin.getConfiguration().getApplyRegex())) { + if (!node.shouldApplyOnServer(context.getServer(), context.isApplyGlobalGroups(), plugin.getConfiguration().isApplyingRegex())) { iterator.remove(); continue; } - if (!node.shouldApplyOnWorld(context.getWorld(), context.isApplyGlobalWorldGroups(), plugin.getConfiguration().getApplyRegex())) { + if (!node.shouldApplyOnWorld(context.getWorld(), context.isApplyGlobalWorldGroups(), plugin.getConfiguration().isApplyingRegex())) { iterator.remove(); continue; } @@ -214,11 +214,11 @@ public abstract class PermissionHolder { all: for (Node node : allNodes) { - if (!node.shouldApplyOnServer(context.getServer(), context.isIncludeGlobal(), plugin.getConfiguration().getApplyRegex())) { + if (!node.shouldApplyOnServer(context.getServer(), context.isIncludeGlobal(), plugin.getConfiguration().isApplyingRegex())) { continue; } - if (!node.shouldApplyOnWorld(context.getWorld(), context.isIncludeGlobalWorld(), plugin.getConfiguration().getApplyRegex())) { + if (!node.shouldApplyOnWorld(context.getWorld(), context.isIncludeGlobalWorld(), plugin.getConfiguration().isApplyingRegex())) { continue; } @@ -251,7 +251,7 @@ public abstract class PermissionHolder { for (Node node : getAllNodesFiltered(context)) { if (possibleNodes != null && !possibleNodes.isEmpty()) { if (node.getPermission().equals("*") || node.getPermission().equals("'*'")) { - if (plugin.getConfiguration().getApplyWildcards()) { + if (plugin.getConfiguration().isApplyingWildcards()) { possibleNodes.forEach(n -> perms.put(n, true)); } } @@ -259,14 +259,14 @@ public abstract class PermissionHolder { perms.put(node.getPermission(), node.getValue()); - if (plugin.getConfiguration().getApplyShorthand()) { + if (plugin.getConfiguration().isApplyingShorthand()) { node.resolveShorthand().stream() .filter(s -> !perms.containsKey(s)) .forEach(s -> perms.put(s, node.getValue())); } if (possibleNodes != null && !possibleNodes.isEmpty()) { - if (plugin.getConfiguration().getApplyWildcards()) { + if (plugin.getConfiguration().isApplyingWildcards()) { node.resolveWildcard(possibleNodes).stream() .filter(s -> !perms.containsKey(s)) .forEach(s -> perms.put(s, node.getValue())); @@ -552,12 +552,12 @@ public abstract class PermissionHolder { */ @Deprecated public Map getLocalPermissions(String server, String world, List excludedGroups, List possibleNodes) { - return exportNodes(new Contexts(server, world, Collections.emptyMap(), plugin.getConfiguration().getIncludeGlobalPerms(), true, true, true, true), Collections.emptyList()); + return exportNodes(new Contexts(server, world, Collections.emptyMap(), plugin.getConfiguration().isIncludingGlobalPerms(), true, true, true, true), Collections.emptyList()); } @Deprecated public Map getLocalPermissions(String server, String world, List excludedGroups) { - return exportNodes(new Contexts(server, world, Collections.emptyMap(), plugin.getConfiguration().getIncludeGlobalPerms(), true, true, true, true), Collections.emptyList()); + return exportNodes(new Contexts(server, world, Collections.emptyMap(), plugin.getConfiguration().isIncludingGlobalPerms(), true, true, true, true), Collections.emptyList()); } @SuppressWarnings("deprecation") diff --git a/common/src/main/java/me/lucko/luckperms/data/LogEntry.java b/common/src/main/java/me/lucko/luckperms/data/LogEntry.java index 4905bd9a6..302e01cde 100644 --- a/common/src/main/java/me/lucko/luckperms/data/LogEntry.java +++ b/common/src/main/java/me/lucko/luckperms/data/LogEntry.java @@ -50,7 +50,7 @@ public class LogEntry extends me.lucko.luckperms.api.LogEntry { plugin.getDatastore().logAction(this); LogNotifyEvent event = new LogNotifyEvent(this); - event.setCancelled(!plugin.getConfiguration().getLogNotify()); + event.setCancelled(!plugin.getConfiguration().isLogNotify()); plugin.getApiProvider().fireEvent(event); if (event.isCancelled()) return; diff --git a/common/src/main/java/me/lucko/luckperms/groups/Group.java b/common/src/main/java/me/lucko/luckperms/groups/Group.java index b466257da..8d4288f22 100644 --- a/common/src/main/java/me/lucko/luckperms/groups/Group.java +++ b/common/src/main/java/me/lucko/luckperms/groups/Group.java @@ -58,6 +58,15 @@ public class Group extends PermissionHolder implements Identifiable { return name; } + public String getRawDisplayName() { + return getPlugin().getConfiguration().getGroupNameRewrites().getOrDefault(name, name); + } + + public String getDisplayName() { + String dn = getRawDisplayName(); + return dn.equals(name) ? name : name + " (" + dn + ")"; + } + /** * check to see if a group inherits a group * @param group The group to check membership of diff --git a/common/src/main/java/me/lucko/luckperms/storage/StorageFactory.java b/common/src/main/java/me/lucko/luckperms/storage/StorageFactory.java index 4ee739184..9ac6bea12 100644 --- a/common/src/main/java/me/lucko/luckperms/storage/StorageFactory.java +++ b/common/src/main/java/me/lucko/luckperms/storage/StorageFactory.java @@ -37,16 +37,14 @@ import java.util.Set; public class StorageFactory { private static final Set TYPES = ImmutableSet.of("json", "yaml", "flatfile", "mongodb", "mysql", "sqlite", "h2"); - @SuppressWarnings("unchecked") public static Datastore getDatastore(LuckPermsPlugin plugin, String defaultMethod) { Datastore datastore; plugin.getLog().info("Detecting storage method..."); - if (plugin.getConfiguration().getSplitStorage()) { + if (plugin.getConfiguration().isSplitStorage()) { plugin.getLog().info("Using split storage."); - // java sucks - Map types = (Map) plugin.getConfiguration().getSplitStorageOptions(); + Map types = plugin.getConfiguration().getSplitStorageOptions(); types.entrySet().stream() .filter(e -> !TYPES.contains(e.getValue().toLowerCase())) diff --git a/common/src/main/java/me/lucko/luckperms/utils/Contexts.java b/common/src/main/java/me/lucko/luckperms/utils/Contexts.java index 0a07783da..f2752aa47 100644 --- a/common/src/main/java/me/lucko/luckperms/utils/Contexts.java +++ b/common/src/main/java/me/lucko/luckperms/utils/Contexts.java @@ -37,11 +37,11 @@ public class Contexts { configuration.getServer(), null, Collections.emptyMap(), - configuration.getIncludeGlobalPerms(), - configuration.getIncludeGlobalWorldPerms(), + configuration.isIncludingGlobalPerms(), + configuration.isIncludingGlobalWorldPerms(), true, - configuration.getApplyGlobalGroups(), - configuration.getApplyGlobalWorldGroups() + configuration.isApplyingGlobalGroups(), + configuration.isApplyingGlobalWorldGroups() ); } diff --git a/sponge/src/main/java/me/lucko/luckperms/LPSpongePlugin.java b/sponge/src/main/java/me/lucko/luckperms/LPSpongePlugin.java index 2360a4ac7..e28f18279 100644 --- a/sponge/src/main/java/me/lucko/luckperms/LPSpongePlugin.java +++ b/sponge/src/main/java/me/lucko/luckperms/LPSpongePlugin.java @@ -115,7 +115,7 @@ public class LPSpongePlugin implements LuckPermsPlugin { datastore = StorageFactory.getDatastore(this, "h2"); getLog().info("Loading internal permission managers..."); - uuidCache = new UuidCache(getConfiguration().getOnlineMode()); + uuidCache = new UuidCache(getConfiguration().isOnlineMode()); userManager = new SpongeUserManager(this); groupManager = new GroupManager(this); trackManager = new TrackManager(); diff --git a/sponge/src/main/java/me/lucko/luckperms/SpongeConfig.java b/sponge/src/main/java/me/lucko/luckperms/SpongeConfig.java index b868a0a77..8dd912d2d 100644 --- a/sponge/src/main/java/me/lucko/luckperms/SpongeConfig.java +++ b/sponge/src/main/java/me/lucko/luckperms/SpongeConfig.java @@ -23,7 +23,7 @@ package me.lucko.luckperms; import com.google.common.base.Splitter; -import me.lucko.luckperms.core.LPConfiguration; +import me.lucko.luckperms.core.AbstractConfiguration; import ninja.leaping.configurate.ConfigurationNode; import ninja.leaping.configurate.commented.CommentedConfigurationNode; import ninja.leaping.configurate.hocon.HoconConfigurationLoader; @@ -34,8 +34,10 @@ import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; +import java.util.Map; +import java.util.stream.Collectors; -class SpongeConfig extends LPConfiguration { +class SpongeConfig extends AbstractConfiguration { private ConfigurationNode root; SpongeConfig(LPSpongePlugin plugin) { @@ -80,11 +82,6 @@ class SpongeConfig extends LPConfiguration { return node; } - @Override - protected void set(String path, Object value) { - getNode(path).setValue(value); - } - @Override protected String getString(String path, String def) { return getNode(path).getString(def); @@ -99,4 +96,10 @@ class SpongeConfig extends LPConfiguration { protected boolean getBoolean(String path, boolean def) { return getNode(path).getBoolean(def); } + + @Override + protected Map getMap(String path, Map def) { + ConfigurationNode node = getNode(path); + return node.getChildrenList().stream().collect(Collectors.toMap(n -> (String) n.getKey(), ConfigurationNode::getString)); + } } diff --git a/sponge/src/main/java/me/lucko/luckperms/api/sponge/LuckPermsSubject.java b/sponge/src/main/java/me/lucko/luckperms/api/sponge/LuckPermsSubject.java index 99aa70895..9afd3b7de 100644 --- a/sponge/src/main/java/me/lucko/luckperms/api/sponge/LuckPermsSubject.java +++ b/sponge/src/main/java/me/lucko/luckperms/api/sponge/LuckPermsSubject.java @@ -213,7 +213,7 @@ public class LuckPermsSubject implements Subject { continue; } - if (!n.shouldApplyOnServer(service.getPlugin().getConfiguration().getVaultServer(), service.getPlugin().getConfiguration().getVaultIncludeGlobal(), false)) { + if (!n.shouldApplyOnServer(service.getPlugin().getConfiguration().getVaultServer(), service.getPlugin().getConfiguration().isVaultIncludingGlobal(), false)) { continue; } diff --git a/sponge/src/main/java/me/lucko/luckperms/api/sponge/LuckPermsUserSubject.java b/sponge/src/main/java/me/lucko/luckperms/api/sponge/LuckPermsUserSubject.java index 772c9357a..7685ae6e0 100644 --- a/sponge/src/main/java/me/lucko/luckperms/api/sponge/LuckPermsUserSubject.java +++ b/sponge/src/main/java/me/lucko/luckperms/api/sponge/LuckPermsUserSubject.java @@ -56,16 +56,16 @@ public class LuckPermsUserSubject extends LuckPermsSubject { List processors = new ArrayList<>(5); processors.add(new PermissionCalculator.MapProcessor(permissionCache)); - if (service.getPlugin().getConfiguration().getApplyWildcards()) { + if (service.getPlugin().getConfiguration().isApplyingWildcards()) { processors.add(new SpongeWildcardProcessor(permissionCache)); processors.add(new PermissionCalculator.WildcardProcessor(permissionCache)); } - if (service.getPlugin().getConfiguration().getApplyRegex()) { + if (service.getPlugin().getConfiguration().isApplyingRegex()) { processors.add(new PermissionCalculator.RegexProcessor(permissionCache)); } processors.add(new SpongeDefaultsProcessor(service)); - calculator = new PermissionCalculator(service.getPlugin(), user.getName(), service.getPlugin().getConfiguration().getDebugPermissionChecks(), processors); + calculator = new PermissionCalculator(service.getPlugin(), user.getName(), service.getPlugin().getConfiguration().isDebugPermissionChecks(), processors); } public void invalidateCache() { diff --git a/sponge/src/main/java/me/lucko/luckperms/users/SpongeUser.java b/sponge/src/main/java/me/lucko/luckperms/users/SpongeUser.java index 4e38f75d4..907ae7453 100644 --- a/sponge/src/main/java/me/lucko/luckperms/users/SpongeUser.java +++ b/sponge/src/main/java/me/lucko/luckperms/users/SpongeUser.java @@ -59,11 +59,11 @@ class SpongeUser extends User { plugin.getConfiguration().getServer(), null, // TODO per world perms null, - plugin.getConfiguration().getIncludeGlobalPerms(), - plugin.getConfiguration().getIncludeGlobalWorldPerms(), + plugin.getConfiguration().isIncludingGlobalPerms(), + plugin.getConfiguration().isIncludingGlobalWorldPerms(), true, - plugin.getConfiguration().getApplyGlobalGroups(), - plugin.getConfiguration().getApplyGlobalWorldGroups() + plugin.getConfiguration().isApplyingGlobalGroups(), + plugin.getConfiguration().isApplyingGlobalWorldGroups() ), Collections.emptyList() ); diff --git a/sponge/src/main/resources/luckperms.conf b/sponge/src/main/resources/luckperms.conf index c693d06cb..487dc6db1 100644 --- a/sponge/src/main/resources/luckperms.conf +++ b/sponge/src/main/resources/luckperms.conf @@ -55,6 +55,18 @@ debug-permission-checks=false # If the plugin should send log notifications to users whenever permissions are modified. log-notify=true +# Mirrors world names. Whenever LuckPerms checks what world a user is in, if the world name is in this list, the value assigned +# will be sent forward for permission calculation instead. +world-rewrite: { + #world_nether="world" + #world_the_end="world" +} + +# Rewrites group names. The underlying name of the group does not change, just the output in commands / placeholders / Vault. +group-name-rewrite: { + #default: "Member" +} + # Which storage method the plugin should use. # Currently supported: mysql, sqlite, h2, json, yaml, mongodb # Fill out connection info below if you're using MySQL or MongoDB diff --git a/standalone/src/main/java/me/lucko/luckperms/internal/StandaloneConfiguration.java b/standalone/src/main/java/me/lucko/luckperms/internal/StandaloneConfiguration.java index df6902c80..7d7605c76 100644 --- a/standalone/src/main/java/me/lucko/luckperms/internal/StandaloneConfiguration.java +++ b/standalone/src/main/java/me/lucko/luckperms/internal/StandaloneConfiguration.java @@ -22,9 +22,11 @@ package me.lucko.luckperms.internal; -import me.lucko.luckperms.core.LPConfiguration; +import me.lucko.luckperms.core.AbstractConfiguration; -public class StandaloneConfiguration extends LPConfiguration { +import java.util.Map; + +public class StandaloneConfiguration extends AbstractConfiguration { public StandaloneConfiguration(StandaloneBase plugin) { super(plugin, "global", true, "null"); } @@ -33,11 +35,6 @@ public class StandaloneConfiguration extends LPConfiguration { protected void init() { } - @Override - protected void set(String path, Object value) { - - } - @Override protected String getString(String path, String def) { return def; @@ -52,4 +49,9 @@ public class StandaloneConfiguration extends LPConfiguration { protected boolean getBoolean(String path, boolean def) { return def; } + + @Override + protected Map getMap(String path, Map def) { + return def; + } }