Add world and group name rewriting, refactor configs

This commit is contained in:
Luck 2016-09-23 18:58:19 +01:00
parent 12cd4e19cb
commit f48595b1ff
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
57 changed files with 420 additions and 309 deletions

View File

@ -22,14 +22,17 @@
package me.lucko.luckperms; 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.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
class BukkitConfig extends LPConfiguration<LPBukkitPlugin> { class BukkitConfig extends AbstractConfiguration<LPBukkitPlugin> {
private YamlConfiguration configuration; private YamlConfiguration configuration;
BukkitConfig(LPBukkitPlugin plugin) { BukkitConfig(LPBukkitPlugin plugin) {
@ -55,11 +58,6 @@ class BukkitConfig extends LPConfiguration<LPBukkitPlugin> {
} }
} }
@Override
protected void set(String path, Object value) {
configuration.set(path, value);
}
@Override @Override
protected String getString(String path, String def) { protected String getString(String path, String def) {
return configuration.getString(path, def); return configuration.getString(path, def);
@ -74,4 +72,20 @@ class BukkitConfig extends LPConfiguration<LPBukkitPlugin> {
protected boolean getBoolean(String path, boolean def) { protected boolean getBoolean(String path, boolean def) {
return configuration.getBoolean(path, def); return configuration.getBoolean(path, def);
} }
@SuppressWarnings("unchecked")
@Override
protected Map<String, String> getMap(String path, Map<String, String> def) {
Map<String, String> 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;
}
} }

View File

@ -104,7 +104,7 @@ class BukkitListener extends AbstractListener implements Listener {
@EventHandler @EventHandler
public void onPlayerCommand(PlayerCommandPreprocessEvent e) { public void onPlayerCommand(PlayerCommandPreprocessEvent e) {
if (plugin.getConfiguration().getEnableOps()) { if (plugin.getConfiguration().isOpsEnabled()) {
return; return;
} }

View File

@ -95,7 +95,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
datastore = StorageFactory.getDatastore(this, "h2"); datastore = StorageFactory.getDatastore(this, "h2");
getLog().info("Loading internal permission managers..."); getLog().info("Loading internal permission managers...");
uuidCache = new UuidCache(getConfiguration().getOnlineMode()); uuidCache = new UuidCache(getConfiguration().isOnlineMode());
userManager = new BukkitUserManager(this); userManager = new BukkitUserManager(this);
groupManager = new GroupManager(this); groupManager = new GroupManager(this);
trackManager = new TrackManager(); trackManager = new TrackManager();
@ -139,8 +139,8 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
e.printStackTrace(); e.printStackTrace();
} }
registerPermissions(getConfiguration().getCommandsAllowOp() ? PermissionDefault.OP : PermissionDefault.FALSE); registerPermissions(getConfiguration().isCommandsAllowOp() ? PermissionDefault.OP : PermissionDefault.FALSE);
if (!getConfiguration().getEnableOps()) { if (!getConfiguration().isOpsEnabled()) {
getServer().getOperators().forEach(o -> o.setOp(false)); getServer().getOperators().forEach(o -> o.setOp(false));
} }

View File

@ -40,7 +40,7 @@ public class VaultHook {
} }
permissionHook.setPlugin(plugin); permissionHook.setPlugin(plugin);
permissionHook.setServer(plugin.getConfiguration().getVaultServer()); permissionHook.setServer(plugin.getConfiguration().getVaultServer());
permissionHook.setIncludeGlobal(plugin.getConfiguration().getVaultIncludeGlobal()); permissionHook.setIncludeGlobal(plugin.getConfiguration().isVaultIncludingGlobal());
if (chatHook == null) { if (chatHook == null) {
chatHook = new VaultChatHook(permissionHook); chatHook = new VaultChatHook(permissionHook);

View File

@ -62,15 +62,15 @@ public class LPPermissible extends PermissibleBase {
List<PermissionProcessor> processors = new ArrayList<>(5); List<PermissionProcessor> processors = new ArrayList<>(5);
processors.add(new PermissionCalculator.MapProcessor(luckPermsPermissions)); processors.add(new PermissionCalculator.MapProcessor(luckPermsPermissions));
processors.add(new AttachmentProcessor(attachmentPermissions)); processors.add(new AttachmentProcessor(attachmentPermissions));
if (plugin.getConfiguration().getApplyWildcards()) { if (plugin.getConfiguration().isApplyingWildcards()) {
processors.add(new PermissionCalculator.WildcardProcessor(luckPermsPermissions)); processors.add(new PermissionCalculator.WildcardProcessor(luckPermsPermissions));
} }
if (plugin.getConfiguration().getApplyRegex()) { if (plugin.getConfiguration().isApplyingRegex()) {
processors.add(new PermissionCalculator.RegexProcessor(luckPermsPermissions)); processors.add(new PermissionCalculator.RegexProcessor(luckPermsPermissions));
} }
processors.add(new BukkitDefaultsProcessor(parent::isOp, defaultsProvider)); 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(); recalculatePermissions();
} }

View File

@ -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. // 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<String, Boolean> toApply = exportNodes( Map<String, Boolean> toApply = exportNodes(
new Contexts( new Contexts(
getPlugin().getConfiguration().getServer(), getPlugin().getConfiguration().getServer(),
plugin.getUserManager().getWorldCache().get(getUuid()), getPlugin().getConfiguration().getWorldRewrites().getOrDefault(world, world),
null, null,
getPlugin().getConfiguration().getIncludeGlobalPerms(), getPlugin().getConfiguration().isIncludingGlobalPerms(),
getPlugin().getConfiguration().getIncludeGlobalWorldPerms(), getPlugin().getConfiguration().isIncludingGlobalWorldPerms(),
true, true,
getPlugin().getConfiguration().getApplyGlobalGroups(), getPlugin().getConfiguration().isApplyingGlobalGroups(),
getPlugin().getConfiguration().getApplyGlobalWorldGroups() getPlugin().getConfiguration().isApplyingGlobalWorldGroups()
), ),
Collections.emptyList() Collections.emptyList()
); );
@ -96,7 +97,7 @@ public class BukkitUser extends User {
lpPermissible.invalidateCache(); lpPermissible.invalidateCache();
existing.putAll(toApply); existing.putAll(toApply);
if (plugin.getConfiguration().getAutoOp()) { if (plugin.getConfiguration().isAutoOp()) {
boolean op = false; boolean op = false;
for (Map.Entry<String, Boolean> e : toApply.entrySet()) { for (Map.Entry<String, Boolean> e : toApply.entrySet()) {

View File

@ -55,7 +55,7 @@ public class BukkitUserManager extends UserManager {
u.setLpPermissible(null); u.setLpPermissible(null);
} }
if (plugin.getConfiguration().getAutoOp()) { if (plugin.getConfiguration().isAutoOp()) {
player.setOp(false); player.setOp(false);
} }
} }

View File

@ -80,6 +80,16 @@ vault-server: global
# If global permissions should be considered when retrieving meta or player groups # If global permissions should be considered when retrieving meta or player groups
vault-include-global: true 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. # Which storage method the plugin should use.
# Currently supported: mysql, sqlite, h2, json, yaml, mongodb # Currently supported: mysql, sqlite, h2, json, yaml, mongodb
# Fill out connection info below if you're using MySQL or MongoDB # Fill out connection info below if you're using MySQL or MongoDB

View File

@ -22,7 +22,7 @@
package me.lucko.luckperms; 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.Configuration;
import net.md_5.bungee.config.ConfigurationProvider; import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration; import net.md_5.bungee.config.YamlConfiguration;
@ -31,8 +31,9 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.Map;
class BungeeConfig extends LPConfiguration<LPBungeePlugin> { class BungeeConfig extends AbstractConfiguration<LPBungeePlugin> {
private Configuration configuration; private Configuration configuration;
BungeeConfig(LPBungeePlugin plugin) { BungeeConfig(LPBungeePlugin plugin) {
@ -62,11 +63,6 @@ class BungeeConfig extends LPConfiguration<LPBungeePlugin> {
} }
} }
@Override
protected void set(String path, Object value) {
configuration.set(path, value);
}
@Override @Override
protected String getString(String path, String def) { protected String getString(String path, String def) {
return configuration.getString(path, def); return configuration.getString(path, def);
@ -81,4 +77,9 @@ class BungeeConfig extends LPConfiguration<LPBungeePlugin> {
protected boolean getBoolean(String path, boolean def) { protected boolean getBoolean(String path, boolean def) {
return configuration.getBoolean(path, def); return configuration.getBoolean(path, def);
} }
@Override
protected Map<String, String> getMap(String path, Map<String, String> def) {
return configuration.get(path, def);
}
} }

View File

@ -41,14 +41,14 @@ public class BungeePlayerCache {
public BungeePlayerCache(LuckPermsPlugin plugin, String name) { public BungeePlayerCache(LuckPermsPlugin plugin, String name) {
List<PermissionProcessor> processors = new ArrayList<>(3); List<PermissionProcessor> processors = new ArrayList<>(3);
processors.add(new PermissionCalculator.MapProcessor(permissions)); processors.add(new PermissionCalculator.MapProcessor(permissions));
if (plugin.getConfiguration().getApplyWildcards()) { if (plugin.getConfiguration().isApplyingWildcards()) {
processors.add(new PermissionCalculator.WildcardProcessor(permissions)); processors.add(new PermissionCalculator.WildcardProcessor(permissions));
} }
if (plugin.getConfiguration().getApplyRegex()) { if (plugin.getConfiguration().isApplyingRegex()) {
processors.add(new PermissionCalculator.RegexProcessor(permissions)); 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() { public void invalidateCache() {

View File

@ -88,7 +88,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
datastore = StorageFactory.getDatastore(this, "h2"); datastore = StorageFactory.getDatastore(this, "h2");
getLog().info("Loading internal permission managers..."); getLog().info("Loading internal permission managers...");
uuidCache = new UuidCache(getConfiguration().getOnlineMode()); uuidCache = new UuidCache(getConfiguration().isOnlineMode());
userManager = new BungeeUserManager(this); userManager = new BungeeUserManager(this);
groupManager = new GroupManager(this); groupManager = new GroupManager(this);
trackManager = new TrackManager(); trackManager = new TrackManager();

View File

@ -64,13 +64,13 @@ public class BungeeUser extends User {
Map<String, Boolean> toApply = exportNodes( Map<String, Boolean> toApply = exportNodes(
new Contexts( new Contexts(
plugin.getConfiguration().getServer(), plugin.getConfiguration().getServer(),
server, plugin.getConfiguration().getWorldRewrites().getOrDefault(server, server),
null, null,
plugin.getConfiguration().getIncludeGlobalPerms(), plugin.getConfiguration().isIncludingGlobalPerms(),
plugin.getConfiguration().getIncludeGlobalWorldPerms(), plugin.getConfiguration().isIncludingGlobalWorldPerms(),
true, true,
plugin.getConfiguration().getApplyGlobalGroups(), plugin.getConfiguration().isApplyingGlobalGroups(),
plugin.getConfiguration().getApplyGlobalWorldGroups() plugin.getConfiguration().isApplyingGlobalWorldGroups()
), ),
Collections.emptyList() Collections.emptyList()
); );

View File

@ -59,6 +59,18 @@ log-notify: true
# If LuckPerms should print to console every time a plugin checks if a player has a permission # If LuckPerms should print to console every time a plugin checks if a player has a permission
debug-permission-checks: false 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. # Which storage method the plugin should use.
# Currently supported: mysql, sqlite, h2, json, yaml, mongodb # Currently supported: mysql, sqlite, h2, json, yaml, mongodb
# Fill out connection info below if you're using MySQL or MongoDB # Fill out connection info below if you're using MySQL or MongoDB

View File

@ -58,67 +58,67 @@ public class LPConfigurationLink implements LPConfiguration {
@Override @Override
public boolean getIncludeGlobalPerms() { public boolean getIncludeGlobalPerms() {
return master.getIncludeGlobalPerms(); return master.isIncludingGlobalPerms();
} }
@Override @Override
public boolean getIncludeGlobalWorldPerms() { public boolean getIncludeGlobalWorldPerms() {
return master.getIncludeGlobalWorldPerms(); return master.isIncludingGlobalWorldPerms();
} }
@Override @Override
public boolean getApplyGlobalGroups() { public boolean getApplyGlobalGroups() {
return master.getApplyGlobalGroups(); return master.isApplyingGlobalGroups();
} }
@Override @Override
public boolean getApplyGlobalWorldGroups() { public boolean getApplyGlobalWorldGroups() {
return master.getApplyGlobalWorldGroups(); return master.isApplyingGlobalWorldGroups();
} }
@Override @Override
public boolean getOnlineMode() { public boolean getOnlineMode() {
return master.getOnlineMode(); return master.isOnlineMode();
} }
@Override @Override
public boolean getApplyWildcards() { public boolean getApplyWildcards() {
return master.getApplyWildcards(); return master.isApplyingWildcards();
} }
@Override @Override
public boolean getApplyRegex() { public boolean getApplyRegex() {
return master.getApplyRegex(); return master.isApplyingRegex();
} }
@Override @Override
public boolean getApplyShorthand() { public boolean getApplyShorthand() {
return master.getApplyShorthand(); return master.isApplyingShorthand();
} }
@Override @Override
public boolean getLogNotify() { public boolean getLogNotify() {
return master.getLogNotify(); return master.isLogNotify();
} }
@Override @Override
public boolean getDebugPermissionChecks() { public boolean getDebugPermissionChecks() {
return master.getDebugPermissionChecks(); return master.isDebugPermissionChecks();
} }
@Override @Override
public boolean getEnableOps() { public boolean getEnableOps() {
return master.getEnableOps(); return master.isOpsEnabled();
} }
@Override @Override
public boolean getCommandsAllowOp() { public boolean getCommandsAllowOp() {
return master.getCommandsAllowOp(); return master.isCommandsAllowOp();
} }
@Override @Override
public boolean getAutoOp() { public boolean getAutoOp() {
return master.getAutoOp(); return master.isAutoOp();
} }
@Override @Override
@ -128,7 +128,7 @@ public class LPConfigurationLink implements LPConfiguration {
@Override @Override
public boolean getVaultIncludeGlobal() { public boolean getVaultIncludeGlobal() {
return master.getVaultIncludeGlobal(); return master.isVaultIncludingGlobal();
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -149,10 +149,9 @@ public class LPConfigurationLink implements LPConfiguration {
@Override @Override
public boolean getSplitStorage() { public boolean getSplitStorage() {
return master.getSplitStorage(); return master.isSplitStorage();
} }
@SuppressWarnings("unchecked")
@Override @Override
public Map<String, String> getSplitStorageOptions() { public Map<String, String> getSplitStorageOptions() {
return master.getSplitStorageOptions(); return master.getSplitStorageOptions();

View File

@ -71,7 +71,7 @@ public class DeleteGroup extends SingleMainCommand {
return CommandResult.FAILURE; 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); LogEntry.build().actor(sender).actedName(groupName).type('G').action("delete").build().submit(plugin, sender);
plugin.runUpdateTask(); plugin.runUpdateTask();
return CommandResult.SUCCESS; return CommandResult.SUCCESS;

View File

@ -29,9 +29,11 @@ import me.lucko.luckperms.commands.SingleMainCommand;
import me.lucko.luckperms.commands.Util; import me.lucko.luckperms.commands.Util;
import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.groups.Group;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
public class ListGroups extends SingleMainCommand { public class ListGroups extends SingleMainCommand {
public ListGroups() { public ListGroups() {
@ -45,7 +47,13 @@ public class ListGroups extends SingleMainCommand {
return CommandResult.LOADING_ERROR; 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; return CommandResult.SUCCESS;
} }
} }

View File

@ -65,14 +65,14 @@ public class GroupAddPrefix extends SubCommand<Group> {
if (args.size() == 3) { if (args.size() == 3) {
group.setPermission(node, true, server); 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) LogEntry.build().actor(sender).acted(group)
.action("addprefix " + priority + " " + args.get(1) + " " + server) .action("addprefix " + priority + " " + args.get(1) + " " + server)
.build().submit(plugin, sender); .build().submit(plugin, sender);
} else { } else {
final String world = args.get(3).toLowerCase(); final String world = args.get(3).toLowerCase();
group.setPermission(node, true, server, world); 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) LogEntry.build().actor(sender).acted(group)
.action("addprefix " + priority + " " + args.get(1) + " " + server + " " + world) .action("addprefix " + priority + " " + args.get(1) + " " + server + " " + world)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -80,7 +80,7 @@ public class GroupAddPrefix extends SubCommand<Group> {
} else { } else {
group.setPermission(node, true); 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) LogEntry.build().actor(sender).acted(group)
.action("addprefix " + priority + " " + args.get(1)) .action("addprefix " + priority + " " + args.get(1))
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -89,7 +89,7 @@ public class GroupAddPrefix extends SubCommand<Group> {
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectAlreadyHasException e) { } catch (ObjectAlreadyHasException e) {
Message.ALREADY_HAS_PREFIX.send(sender, group.getName()); Message.ALREADY_HAS_PREFIX.send(sender, group.getDisplayName());
return CommandResult.STATE_ERROR; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -65,14 +65,14 @@ public class GroupAddSuffix extends SubCommand<Group> {
if (args.size() == 3) { if (args.size() == 3) {
group.setPermission(node, true, server); 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) LogEntry.build().actor(sender).acted(group)
.action("addsuffix " + priority + " " + args.get(1) + " " + server) .action("addsuffix " + priority + " " + args.get(1) + " " + server)
.build().submit(plugin, sender); .build().submit(plugin, sender);
} else { } else {
final String world = args.get(3).toLowerCase(); final String world = args.get(3).toLowerCase();
group.setPermission(node, true, server, world); 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) LogEntry.build().actor(sender).acted(group)
.action("addsuffix " + priority + " " + args.get(1) + " " + server + " " + world) .action("addsuffix " + priority + " " + args.get(1) + " " + server + " " + world)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -80,7 +80,7 @@ public class GroupAddSuffix extends SubCommand<Group> {
} else { } else {
group.setPermission(node, true); 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) LogEntry.build().actor(sender).acted(group)
.action("addsuffix " + priority + " " + args.get(1)) .action("addsuffix " + priority + " " + args.get(1))
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -89,7 +89,7 @@ public class GroupAddSuffix extends SubCommand<Group> {
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectAlreadyHasException e) { } catch (ObjectAlreadyHasException e) {
Message.ALREADY_HAS_SUFFIX.send(sender, group.getName()); Message.ALREADY_HAS_SUFFIX.send(sender, group.getDisplayName());
return CommandResult.STATE_ERROR; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -83,14 +83,14 @@ public class GroupAddTempPrefix extends SubCommand<Group> {
if (args.size() == 4) { if (args.size() == 4) {
group.setPermission(node, true, server, duration); 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) LogEntry.build().actor(sender).acted(group)
.action("addtempprefix " + priority + " " + args.get(1) + " " + duration + " " + server) .action("addtempprefix " + priority + " " + args.get(1) + " " + duration + " " + server)
.build().submit(plugin, sender); .build().submit(plugin, sender);
} else { } else {
final String world = args.get(4).toLowerCase(); final String world = args.get(4).toLowerCase();
group.setPermission(node, true, server, world, duration); 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) LogEntry.build().actor(sender).acted(group)
.action("addtempprefix " + priority + " " + args.get(1) + " " + duration + " " + server + " " + world) .action("addtempprefix " + priority + " " + args.get(1) + " " + duration + " " + server + " " + world)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -98,7 +98,7 @@ public class GroupAddTempPrefix extends SubCommand<Group> {
} else { } else {
group.setPermission(node, true, duration); 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) LogEntry.build().actor(sender).acted(group)
.action("addtempprefix " + priority + " " + args.get(1) + " " + duration) .action("addtempprefix " + priority + " " + args.get(1) + " " + duration)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -107,7 +107,7 @@ public class GroupAddTempPrefix extends SubCommand<Group> {
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectAlreadyHasException e) { } catch (ObjectAlreadyHasException e) {
Message.ALREADY_HAS_PREFIX.send(sender, group.getName()); Message.ALREADY_HAS_PREFIX.send(sender, group.getDisplayName());
return CommandResult.STATE_ERROR; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -83,14 +83,14 @@ public class GroupAddTempSuffix extends SubCommand<Group> {
if (args.size() == 4) { if (args.size() == 4) {
group.setPermission(node, true, server, duration); 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) LogEntry.build().actor(sender).acted(group)
.action("addtempsuffix " + priority + " " + args.get(1) + " " + duration + " " + server) .action("addtempsuffix " + priority + " " + args.get(1) + " " + duration + " " + server)
.build().submit(plugin, sender); .build().submit(plugin, sender);
} else { } else {
final String world = args.get(4).toLowerCase(); final String world = args.get(4).toLowerCase();
group.setPermission(node, true, server, world, duration); 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) LogEntry.build().actor(sender).acted(group)
.action("addtempsuffix " + priority + " " + args.get(1) + " " + duration + " " + server + " " + world) .action("addtempsuffix " + priority + " " + args.get(1) + " " + duration + " " + server + " " + world)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -98,7 +98,7 @@ public class GroupAddTempSuffix extends SubCommand<Group> {
} else { } else {
group.setPermission(node, true, duration); 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) LogEntry.build().actor(sender).acted(group)
.action("addtempsuffix " + priority + " " + args.get(1) + " " + duration) .action("addtempsuffix " + priority + " " + args.get(1) + " " + duration)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -107,7 +107,7 @@ public class GroupAddTempSuffix extends SubCommand<Group> {
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectAlreadyHasException e) { } catch (ObjectAlreadyHasException e) {
Message.ALREADY_HAS_SUFFIX.send(sender, group.getName()); Message.ALREADY_HAS_SUFFIX.send(sender, group.getDisplayName());
return CommandResult.STATE_ERROR; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -68,18 +68,18 @@ public class GroupChatMeta extends SubCommand<Group> {
} }
if (prefixes.isEmpty()) { if (prefixes.isEmpty()) {
Message.CHAT_META_PREFIX_NONE.send(sender, group.getName()); Message.CHAT_META_PREFIX_NONE.send(sender, group.getDisplayName());
} else { } else {
Message.CHAT_META_PREFIX_HEADER.send(sender, group.getName()); Message.CHAT_META_PREFIX_HEADER.send(sender, group.getDisplayName());
for (Map.Entry<Integer, String> e : prefixes) { for (Map.Entry<Integer, String> e : prefixes) {
Message.CHAT_META_ENTRY.send(sender, e.getKey(), e.getValue()); Message.CHAT_META_ENTRY.send(sender, e.getKey(), e.getValue());
} }
} }
if (suffixes.isEmpty()) { if (suffixes.isEmpty()) {
Message.CHAT_META_SUFFIX_NONE.send(sender, group.getName()); Message.CHAT_META_SUFFIX_NONE.send(sender, group.getDisplayName());
} else { } else {
Message.CHAT_META_SUFFIX_HEADER.send(sender, group.getName()); Message.CHAT_META_SUFFIX_HEADER.send(sender, group.getDisplayName());
for (Map.Entry<Integer, String> e : suffixes) { for (Map.Entry<Integer, String> e : suffixes) {
Message.CHAT_META_ENTRY.send(sender, e.getKey(), e.getValue()); Message.CHAT_META_ENTRY.send(sender, e.getKey(), e.getValue());
} }

View File

@ -43,7 +43,7 @@ public class GroupClear extends SubCommand<Group> {
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
group.clearNodes(); 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); LogEntry.build().actor(sender).acted(group).action("clear").build().submit(plugin, sender);
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;

View File

@ -42,12 +42,13 @@ public class GroupInfo extends SubCommand<Group> {
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
Message.GROUP_INFO.send(sender, Message.GROUP_INFO.send(sender,
group.getName(), group.getDisplayName(),
group.getPermanentNodes().size(), group.getPermanentNodes().size(),
group.getTemporaryNodes().size(), group.getTemporaryNodes().size(),
label, label,
group.getName() group.getName()
); );
// TODO show inheritances
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} }
} }

View File

@ -38,8 +38,8 @@ public class GroupListNodes extends SubCommand<Group> {
@Override @Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
Message.LISTNODES.send(sender, group.getName(), Util.permNodesToString(group.getPermissions(false))); Message.LISTNODES.send(sender, group.getDisplayName(), Util.permNodesToString(group.getPermissions(false)));
Message.LISTNODES_TEMP.send(sender, group.getName(), Util.tempNodesToString(group.getPermissions(false))); Message.LISTNODES_TEMP.send(sender, group.getDisplayName(), Util.tempNodesToString(group.getPermissions(false)));
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} }
} }

View File

@ -65,14 +65,14 @@ public class GroupRemovePrefix extends SubCommand<Group> {
if (args.size() == 3) { if (args.size() == 3) {
group.unsetPermission(node, server); 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) LogEntry.build().actor(sender).acted(group)
.action("removeprefix " + priority + " " + args.get(1) + " " + server) .action("removeprefix " + priority + " " + args.get(1) + " " + server)
.build().submit(plugin, sender); .build().submit(plugin, sender);
} else { } else {
final String world = args.get(3).toLowerCase(); final String world = args.get(3).toLowerCase();
group.unsetPermission(node, server, world); 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) LogEntry.build().actor(sender).acted(group)
.action("removeprefix " + priority + " " + args.get(1) + " " + server + " " + world) .action("removeprefix " + priority + " " + args.get(1) + " " + server + " " + world)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -80,7 +80,7 @@ public class GroupRemovePrefix extends SubCommand<Group> {
} else { } else {
group.unsetPermission(node); 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) LogEntry.build().actor(sender).acted(group)
.action("removeprefix " + priority + " " + args.get(1)) .action("removeprefix " + priority + " " + args.get(1))
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -89,7 +89,7 @@ public class GroupRemovePrefix extends SubCommand<Group> {
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectLacksException e) { } 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; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -65,14 +65,14 @@ public class GroupRemoveSuffix extends SubCommand<Group> {
if (args.size() == 3) { if (args.size() == 3) {
group.unsetPermission(node, server); 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) LogEntry.build().actor(sender).acted(group)
.action("removesuffix " + priority + " " + args.get(1) + " " + server) .action("removesuffix " + priority + " " + args.get(1) + " " + server)
.build().submit(plugin, sender); .build().submit(plugin, sender);
} else { } else {
final String world = args.get(3).toLowerCase(); final String world = args.get(3).toLowerCase();
group.unsetPermission(node, server, world); 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) LogEntry.build().actor(sender).acted(group)
.action("removesuffix " + priority + " " + args.get(1) + " " + server + " " + world) .action("removesuffix " + priority + " " + args.get(1) + " " + server + " " + world)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -80,7 +80,7 @@ public class GroupRemoveSuffix extends SubCommand<Group> {
} else { } else {
group.unsetPermission(node); 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) LogEntry.build().actor(sender).acted(group)
.action("removesuffix " + priority + " " + args.get(1)) .action("removesuffix " + priority + " " + args.get(1))
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -89,7 +89,7 @@ public class GroupRemoveSuffix extends SubCommand<Group> {
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectLacksException e) { } 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; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -65,14 +65,14 @@ public class GroupRemoveTempPrefix extends SubCommand<Group> {
if (args.size() == 3) { if (args.size() == 3) {
group.unsetPermission(node, server, true); 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) LogEntry.build().actor(sender).acted(group)
.action("removetempprefix " + priority + " " + args.get(1) + " " + server) .action("removetempprefix " + priority + " " + args.get(1) + " " + server)
.build().submit(plugin, sender); .build().submit(plugin, sender);
} else { } else {
final String world = args.get(3).toLowerCase(); final String world = args.get(3).toLowerCase();
group.unsetPermission(node, server, world, true); 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) LogEntry.build().actor(sender).acted(group)
.action("removetempprefix " + priority + " " + args.get(1) + " " + server + " " + world) .action("removetempprefix " + priority + " " + args.get(1) + " " + server + " " + world)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -80,7 +80,7 @@ public class GroupRemoveTempPrefix extends SubCommand<Group> {
} else { } else {
group.unsetPermission(node, true); 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) LogEntry.build().actor(sender).acted(group)
.action("removetempprefix " + priority + " " + args.get(1)) .action("removetempprefix " + priority + " " + args.get(1))
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -89,7 +89,7 @@ public class GroupRemoveTempPrefix extends SubCommand<Group> {
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectLacksException e) { } 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; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -65,14 +65,14 @@ public class GroupRemoveTempSuffix extends SubCommand<Group> {
if (args.size() == 3) { if (args.size() == 3) {
group.unsetPermission(node, server, true); 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) LogEntry.build().actor(sender).acted(group)
.action("removetempsuffix " + priority + " " + args.get(1) + " " + server) .action("removetempsuffix " + priority + " " + args.get(1) + " " + server)
.build().submit(plugin, sender); .build().submit(plugin, sender);
} else { } else {
final String world = args.get(3).toLowerCase(); final String world = args.get(3).toLowerCase();
group.unsetPermission(node, server, world, true); 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) LogEntry.build().actor(sender).acted(group)
.action("removetempsuffix " + priority + " " + args.get(1) + " " + server + " " + world) .action("removetempsuffix " + priority + " " + args.get(1) + " " + server + " " + world)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -80,7 +80,7 @@ public class GroupRemoveTempSuffix extends SubCommand<Group> {
} else { } else {
group.unsetPermission(node, true); 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) LogEntry.build().actor(sender).acted(group)
.action("removetempsuffix " + priority + " " + args.get(1)) .action("removetempsuffix " + priority + " " + args.get(1))
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -89,7 +89,7 @@ public class GroupRemoveTempSuffix extends SubCommand<Group> {
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectLacksException e) { } 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; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -73,14 +73,14 @@ public class GroupSetInherit extends SubCommand<Group> {
if (args.size() == 2) { if (args.size() == 2) {
group.setInheritGroup(group1, server); 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) LogEntry.build().actor(sender).acted(group)
.action("setinherit " + group1.getName() + " " + server) .action("setinherit " + group1.getName() + " " + server)
.build().submit(plugin, sender); .build().submit(plugin, sender);
} else { } else {
final String world = args.get(2).toLowerCase(); final String world = args.get(2).toLowerCase();
group.setInheritGroup(group1, server, world); 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) LogEntry.build().actor(sender).acted(group)
.action("setinherit " + group1.getName() + " " + server + " " + world) .action("setinherit " + group1.getName() + " " + server + " " + world)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -88,7 +88,7 @@ public class GroupSetInherit extends SubCommand<Group> {
} else { } else {
group.setInheritGroup(group1); 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) LogEntry.build().actor(sender).acted(group)
.action("setinherit " + group1.getName()) .action("setinherit " + group1.getName())
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -97,7 +97,7 @@ public class GroupSetInherit extends SubCommand<Group> {
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectAlreadyHasException e) { } 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; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -74,14 +74,14 @@ public class GroupSetPermission extends SubCommand<Group> {
if (args.size() == 3) { if (args.size() == 3) {
group.setPermission(node, b, server); 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) LogEntry.build().actor(sender).acted(group)
.action("set " + node + " " + b + " " + server) .action("set " + node + " " + b + " " + server)
.build().submit(plugin, sender); .build().submit(plugin, sender);
} else { } else {
final String world = args.get(3).toLowerCase(); final String world = args.get(3).toLowerCase();
group.setPermission(node, b, server, world); 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) LogEntry.build().actor(sender).acted(group)
.action("set " + node + " " + b + " " + server + " " + world) .action("set " + node + " " + b + " " + server + " " + world)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -89,7 +89,7 @@ public class GroupSetPermission extends SubCommand<Group> {
} else { } else {
group.setPermission(node, b); 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) LogEntry.build().actor(sender).acted(group)
.action("set " + node + " " + b) .action("set " + node + " " + b)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -98,7 +98,7 @@ public class GroupSetPermission extends SubCommand<Group> {
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectAlreadyHasException e) { } catch (ObjectAlreadyHasException e) {
Message.ALREADY_HASPERMISSION.send(sender, group.getName()); Message.ALREADY_HASPERMISSION.send(sender, group.getDisplayName());
return CommandResult.STATE_ERROR; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -91,7 +91,7 @@ public class GroupSetTempInherit extends SubCommand<Group> {
if (args.size() == 3) { if (args.size() == 3) {
group.setInheritGroup(group1, server, duration); 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)); DateUtil.formatDateDiff(duration));
LogEntry.build().actor(sender).acted(group) LogEntry.build().actor(sender).acted(group)
.action("settempinherit " + group1.getName() + " " + duration + " " + server) .action("settempinherit " + group1.getName() + " " + duration + " " + server)
@ -99,7 +99,7 @@ public class GroupSetTempInherit extends SubCommand<Group> {
} else { } else {
final String world = args.get(3).toLowerCase(); final String world = args.get(3).toLowerCase();
group.setInheritGroup(group1, server, world, duration); 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)); world, DateUtil.formatDateDiff(duration));
LogEntry.build().actor(sender).acted(group) LogEntry.build().actor(sender).acted(group)
.action("settempinherit " + group1.getName() + " " + duration + " " + server + " " + world) .action("settempinherit " + group1.getName() + " " + duration + " " + server + " " + world)
@ -108,7 +108,7 @@ public class GroupSetTempInherit extends SubCommand<Group> {
} else { } else {
group.setInheritGroup(group1, duration); 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) LogEntry.build().actor(sender).acted(group)
.action("settempinherit " + group1.getName() + " " + duration) .action("settempinherit " + group1.getName() + " " + duration)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -117,7 +117,7 @@ public class GroupSetTempInherit extends SubCommand<Group> {
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectAlreadyHasException e) { } 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; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -93,7 +93,7 @@ public class GroupSetTempPermission extends SubCommand<Group> {
if (args.size() == 4) { if (args.size() == 4) {
group.setPermission(node, b, server, duration); 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)); DateUtil.formatDateDiff(duration));
LogEntry.build().actor(sender).acted(group) LogEntry.build().actor(sender).acted(group)
.action("settemp " + node + " " + b + " " + duration + " " + server) .action("settemp " + node + " " + b + " " + duration + " " + server)
@ -101,7 +101,7 @@ public class GroupSetTempPermission extends SubCommand<Group> {
} else { } else {
final String world = args.get(4).toLowerCase(); final String world = args.get(4).toLowerCase();
group.setPermission(node, b, server, world, duration); 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)); world, DateUtil.formatDateDiff(duration));
LogEntry.build().actor(sender).acted(group) LogEntry.build().actor(sender).acted(group)
.action("settemp " + node + " " + b + " " + duration + " " + server + " " + world) .action("settemp " + node + " " + b + " " + duration + " " + server + " " + world)
@ -110,7 +110,7 @@ public class GroupSetTempPermission extends SubCommand<Group> {
} else { } else {
group.setPermission(node, b, duration); 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) LogEntry.build().actor(sender).acted(group)
.action("settemp " + node + " " + b + " " + duration) .action("settemp " + node + " " + b + " " + duration)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -119,7 +119,7 @@ public class GroupSetTempPermission extends SubCommand<Group> {
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectAlreadyHasException e) { } 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; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -66,14 +66,14 @@ public class GroupUnSetPermission extends SubCommand<Group> {
if (args.size() == 2) { if (args.size() == 2) {
group.unsetPermission(node, server); 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) LogEntry.build().actor(sender).acted(group)
.action("unset " + node + " " + server) .action("unset " + node + " " + server)
.build().submit(plugin, sender); .build().submit(plugin, sender);
} else { } else {
final String world = args.get(2).toLowerCase(); final String world = args.get(2).toLowerCase();
group.unsetPermission(node, server, world); 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) LogEntry.build().actor(sender).acted(group)
.action("unset " + node + " " + server + " " + world) .action("unset " + node + " " + server + " " + world)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -81,7 +81,7 @@ public class GroupUnSetPermission extends SubCommand<Group> {
} else { } else {
group.unsetPermission(node); 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) LogEntry.build().actor(sender).acted(group)
.action("unset " + node) .action("unset " + node)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -90,7 +90,7 @@ public class GroupUnSetPermission extends SubCommand<Group> {
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectLacksException e) { } catch (ObjectLacksException e) {
Message.DOES_NOT_HAVEPERMISSION.send(sender, group.getName()); Message.DOES_NOT_HAVEPERMISSION.send(sender, group.getDisplayName());
return CommandResult.STATE_ERROR; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -62,14 +62,14 @@ public class GroupUnsetInherit extends SubCommand<Group> {
if (args.size() == 2) { if (args.size() == 2) {
group.unsetPermission("group." + groupName, server); 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) LogEntry.build().actor(sender).acted(group)
.action("unsetinherit " + groupName + " " + server) .action("unsetinherit " + groupName + " " + server)
.build().submit(plugin, sender); .build().submit(plugin, sender);
} else { } else {
final String world = args.get(2).toLowerCase(); final String world = args.get(2).toLowerCase();
group.unsetPermission("group." + groupName, server, world); 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) LogEntry.build().actor(sender).acted(group)
.action("unsetinherit " + groupName + " " + server + " " + world) .action("unsetinherit " + groupName + " " + server + " " + world)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -77,7 +77,7 @@ public class GroupUnsetInherit extends SubCommand<Group> {
} else { } else {
group.unsetPermission("group." + groupName); 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) LogEntry.build().actor(sender).acted(group)
.action("unsetinherit " + groupName) .action("unsetinherit " + groupName)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -86,7 +86,7 @@ public class GroupUnsetInherit extends SubCommand<Group> {
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectLacksException e) { } 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; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -62,14 +62,14 @@ public class GroupUnsetTempInherit extends SubCommand<Group> {
if (args.size() == 2) { if (args.size() == 2) {
group.unsetPermission("group." + groupName, server, true); 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) LogEntry.build().actor(sender).acted(group)
.action("unsettempinherit " + groupName + " " + server) .action("unsettempinherit " + groupName + " " + server)
.build().submit(plugin, sender); .build().submit(plugin, sender);
} else { } else {
final String world = args.get(2).toLowerCase(); final String world = args.get(2).toLowerCase();
group.unsetPermission("group." + groupName, server, world, true); 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) LogEntry.build().actor(sender).acted(group)
.action("unsettempinherit " + groupName + " " + server + " " + world) .action("unsettempinherit " + groupName + " " + server + " " + world)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -77,7 +77,7 @@ public class GroupUnsetTempInherit extends SubCommand<Group> {
} else { } else {
group.unsetPermission("group." + groupName, true); 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) LogEntry.build().actor(sender).acted(group)
.action("unsettempinherit " + groupName) .action("unsettempinherit " + groupName)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -86,7 +86,7 @@ public class GroupUnsetTempInherit extends SubCommand<Group> {
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectLacksException e) { } 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; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -67,14 +67,14 @@ public class GroupUnsetTempPermission extends SubCommand<Group> {
if (args.size() == 2) { if (args.size() == 2) {
group.unsetPermission(node, server); 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) LogEntry.build().actor(sender).acted(group)
.action("unsettemp " + node + " " + server) .action("unsettemp " + node + " " + server)
.build().submit(plugin, sender); .build().submit(plugin, sender);
} else { } else {
final String world = args.get(2).toLowerCase(); final String world = args.get(2).toLowerCase();
group.unsetPermission(node, server, world); 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) LogEntry.build().actor(sender).acted(group)
.action("unsettemp " + node + " " + server + " " + world) .action("unsettemp " + node + " " + server + " " + world)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -82,7 +82,7 @@ public class GroupUnsetTempPermission extends SubCommand<Group> {
} else { } else {
group.unsetPermission(node, true); 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) LogEntry.build().actor(sender).acted(group)
.action("unsettemp " + node) .action("unsettemp " + node)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -91,7 +91,7 @@ public class GroupUnsetTempPermission extends SubCommand<Group> {
save(group, sender, plugin); save(group, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectLacksException e) { } 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; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -48,14 +48,14 @@ public class InfoCommand extends SingleMainCommand {
plugin.getDatastore().getName(), plugin.getDatastore().getName(),
c.getServer(), c.getServer(),
c.getSyncTime(), c.getSyncTime(),
formatBoolean(c.getIncludeGlobalPerms()), formatBoolean(c.isIncludingGlobalPerms()),
formatBoolean(c.getIncludeGlobalWorldPerms()), formatBoolean(c.isIncludingGlobalWorldPerms()),
formatBoolean(c.getApplyGlobalGroups()), formatBoolean(c.isApplyingGlobalGroups()),
formatBoolean(c.getApplyGlobalWorldGroups()), formatBoolean(c.isApplyingGlobalWorldGroups()),
formatBoolean(c.getOnlineMode()), formatBoolean(c.isOnlineMode()),
formatBoolean(c.getApplyWildcards()), formatBoolean(c.isApplyingWildcards()),
formatBoolean(c.getApplyRegex()), formatBoolean(c.isApplyingRegex()),
formatBoolean(c.getApplyShorthand()) formatBoolean(c.isApplyingShorthand())
); );
return CommandResult.SUCCESS; return CommandResult.SUCCESS;

View File

@ -73,14 +73,14 @@ public class UserAddGroup extends SubCommand<User> {
if (args.size() == 2) { if (args.size() == 2) {
user.addGroup(group, server); 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) LogEntry.build().actor(sender).acted(user)
.action("addgroup " + group.getName() + " " + server) .action("addgroup " + group.getName() + " " + server)
.build().submit(plugin, sender); .build().submit(plugin, sender);
} else { } else {
final String world = args.get(2).toLowerCase(); final String world = args.get(2).toLowerCase();
user.addGroup(group, server, world); 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) LogEntry.build().actor(sender).acted(user)
.action("addgroup " + group.getName() + " " + server + " " + world) .action("addgroup " + group.getName() + " " + server + " " + world)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -88,7 +88,7 @@ public class UserAddGroup extends SubCommand<User> {
} else { } else {
user.addGroup(group); 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) LogEntry.build().actor(sender).acted(user)
.action("addgroup " + group.getName()) .action("addgroup " + group.getName())
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -97,7 +97,7 @@ public class UserAddGroup extends SubCommand<User> {
save(user, sender, plugin); save(user, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectAlreadyHasException e) { } 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; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -92,7 +92,7 @@ public class UserAddTempGroup extends SubCommand<User> {
if (args.size() == 3) { if (args.size() == 3) {
user.addGroup(group, server, duration); 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)); DateUtil.formatDateDiff(duration));
LogEntry.build().actor(sender).acted(user) LogEntry.build().actor(sender).acted(user)
.action("addtempgroup " + group.getName() + " " + duration + " " + server) .action("addtempgroup " + group.getName() + " " + duration + " " + server)
@ -100,7 +100,7 @@ public class UserAddTempGroup extends SubCommand<User> {
} else { } else {
final String world = args.get(3).toLowerCase(); final String world = args.get(3).toLowerCase();
user.addGroup(group, server, world, duration); 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)); world, DateUtil.formatDateDiff(duration));
LogEntry.build().actor(sender).acted(user) LogEntry.build().actor(sender).acted(user)
.action("addtempgroup " + group.getName() + " " + duration + " " + server + " " + world) .action("addtempgroup " + group.getName() + " " + duration + " " + server + " " + world)
@ -109,7 +109,7 @@ public class UserAddTempGroup extends SubCommand<User> {
} else { } else {
user.addGroup(group, duration); 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) LogEntry.build().actor(sender).acted(user)
.action("addtempgroup " + group.getName() + " " + duration) .action("addtempgroup " + group.getName() + " " + duration)
.build().submit(plugin, sender); .build().submit(plugin, sender);
@ -118,7 +118,7 @@ public class UserAddTempGroup extends SubCommand<User> {
save(user, sender, plugin); save(user, sender, plugin);
return CommandResult.SUCCESS; return CommandResult.SUCCESS;
} catch (ObjectAlreadyHasException e) { } 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; return CommandResult.STATE_ERROR;
} }
} }

View File

@ -103,9 +103,9 @@ public class UserDemote extends SubCommand<User> {
} catch (ObjectAlreadyHasException ignored) {} } catch (ObjectAlreadyHasException ignored) {}
user.setPrimaryGroup(previousGroup.getName()); user.setPrimaryGroup(previousGroup.getName());
Message.USER_DEMOTE_SUCCESS_PROMOTE.send(sender, track.getName(), old, previousGroup.getName()); Message.USER_DEMOTE_SUCCESS_PROMOTE.send(sender, track.getName(), old, previousGroup.getDisplayName());
Message.USER_DEMOTE_SUCCESS_REMOVE.send(sender, user.getName(), old, previousGroup.getName(), previousGroup.getName()); Message.USER_DEMOTE_SUCCESS_REMOVE.send(sender, user.getName(), old, previousGroup.getDisplayName(), previousGroup.getDisplayName());
Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), previousGroup.getName(), old, true)); Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), previousGroup.getDisplayName(), old, true));
LogEntry.build().actor(sender).acted(user) LogEntry.build().actor(sender).acted(user)
.action("demote " + track.getName() + "(from " + old + " to " + previousGroup.getName() + ")") .action("demote " + track.getName() + "(from " + old + " to " + previousGroup.getName() + ")")
.build().submit(plugin, sender); .build().submit(plugin, sender);

View File

@ -41,7 +41,7 @@ public class UserInfo extends SubCommand<User> {
user.getName(), user.getName(),
user.getUuid(), user.getUuid(),
plugin.getPlayerStatus(user.getUuid()), plugin.getPlayerStatus(user.getUuid()),
Util.listToCommaSep(user.getGroupNames()), Util.listToCommaSep(user.getGroupNames()), // TODO move this to own command
user.getPrimaryGroup(), user.getPrimaryGroup(),
user.getPermanentNodes().size(), user.getPermanentNodes().size(),
user.getTemporaryNodes().size(), user.getTemporaryNodes().size(),

View File

@ -103,9 +103,9 @@ public class UserPromote extends SubCommand<User> {
} catch (ObjectAlreadyHasException ignored) {} } catch (ObjectAlreadyHasException ignored) {}
user.setPrimaryGroup(nextGroup.getName()); user.setPrimaryGroup(nextGroup.getName());
Message.USER_PROMOTE_SUCCESS_PROMOTE.send(sender, track.getName(), old, nextGroup.getName()); Message.USER_PROMOTE_SUCCESS_PROMOTE.send(sender, track.getName(), old, nextGroup.getDisplayName());
Message.USER_PROMOTE_SUCCESS_REMOVE.send(sender, user.getName(), old, nextGroup.getName(), nextGroup.getName()); Message.USER_PROMOTE_SUCCESS_REMOVE.send(sender, user.getName(), old, nextGroup.getDisplayName(), nextGroup.getDisplayName());
Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), old, nextGroup.getName(), false)); Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), old, nextGroup.getDisplayName(), false));
LogEntry.build().actor(sender).acted(user) LogEntry.build().actor(sender).acted(user)
.action("promote " + track.getName() + "(from " + old + " to " + nextGroup.getName() + ")") .action("promote " + track.getName() + "(from " + old + " to " + nextGroup.getName() + ")")
.build().submit(plugin, sender); .build().submit(plugin, sender);

View File

@ -63,7 +63,7 @@ public class UserSetPrimaryGroup extends SubCommand<User> {
} }
user.setPrimaryGroup(group.getName()); 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) LogEntry.build().actor(sender).acted(user)
.action("setprimarygroup " + group.getName()) .action("setprimarygroup " + group.getName())
.build().submit(plugin, sender); .build().submit(plugin, sender);

View File

@ -0,0 +1,129 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* 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 <T> the plugin type
*/
@Getter
public abstract class AbstractConfiguration<T extends LuckPermsPlugin> 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<String, String> worldRewrites;
private Map<String, String> groupNameRewrites;
private DatastoreConfiguration databaseValues;
private String storageMethod;
private boolean splitStorage;
private Map<String, String> 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<String, String> getMap(String path, Map<String, String> 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.<String, String>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;
}
}
}

View File

@ -22,156 +22,68 @@
package me.lucko.luckperms.core; 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 me.lucko.luckperms.storage.DatastoreConfiguration;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
public abstract class LPConfiguration<T extends LuckPermsPlugin> { public interface LPConfiguration {
@Getter(AccessLevel.PROTECTED) String getServer();
private final T plugin;
private final String defaultServerName; int getSyncTime();
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);
}
/** /**
* As of 2.6, this value is a constant * As of 2.6, this value is a constant
* @return the default group node * @return the default group node
*/ */
@SuppressWarnings("SameReturnValue") String getDefaultGroupNode();
public String getDefaultGroupNode() {
return "group.default";
}
/** /**
* As of 2.6, this value is a constant * As of 2.6, this value is a constant
* @return the name of the default group * @return the name of the default group
*/ */
@SuppressWarnings("SameReturnValue") String getDefaultGroupName();
public String getDefaultGroupName() {
return "default";
}
public boolean getIncludeGlobalPerms() { boolean isIncludingGlobalPerms();
return getBoolean("include-global", defaultIncludeGlobal);
}
public boolean getIncludeGlobalWorldPerms() { boolean isIncludingGlobalWorldPerms();
return getBoolean("include-global-world", true);
}
public boolean getApplyGlobalGroups() { boolean isApplyingGlobalGroups();
return getBoolean("apply-global-groups", true);
}
public boolean getApplyGlobalWorldGroups() { boolean isApplyingGlobalWorldGroups();
return getBoolean("apply-global-world-groups", true);
}
public boolean getOnlineMode() { boolean isOnlineMode();
return getBoolean("online-mode", true);
}
public boolean getApplyWildcards() { boolean isApplyingWildcards();
return getBoolean("apply-wildcards", true);
}
public boolean getApplyRegex() { boolean isApplyingRegex();
return getBoolean("apply-regex", true);
}
public boolean getApplyShorthand() { boolean isApplyingShorthand();
return getBoolean("apply-shorthand", true);
}
public boolean getLogNotify() { boolean isLogNotify();
return getBoolean("log-notify", true);
}
public boolean getDebugPermissionChecks() { boolean isDebugPermissionChecks();
return getBoolean("debug-permission-checks", false);
}
public boolean getEnableOps() { boolean isOpsEnabled();
return !getAutoOp() && getBoolean("enable-ops", true);
}
public boolean getCommandsAllowOp() { boolean isCommandsAllowOp();
return getBoolean("commands-allow-op", true);
}
public boolean getAutoOp() { boolean isAutoOp();
return getBoolean("auto-op", false);
}
public String getVaultServer() { String getVaultServer();
return getString("vault-server", "global");
}
public boolean getVaultIncludeGlobal() { boolean isVaultIncludingGlobal();
return getBoolean("vault-include-global", true);
}
public DatastoreConfiguration getDatabaseValues() { Map<String, String> getWorldRewrites();
return new DatastoreConfiguration(
getString("data.address", null),
getString("data.database", null),
getString("data.username", null),
getString("data.password", null)
);
}
public String getStorageMethod() { Map<String, String> getGroupNameRewrites();
return getString("storage-method", defaultStorage);
}
public boolean getSplitStorage() { DatastoreConfiguration getDatabaseValues();
return getBoolean("split-storage.enabled", false);
}
public Map<String, String> getSplitStorageOptions() { String getStorageMethod();
Map<String, String> map = new HashMap<>();
map.put("user", getString("split-storage.methods.user", defaultStorage)); boolean isSplitStorage();
map.put("group", getString("split-storage.methods.group", defaultStorage));
map.put("track", getString("split-storage.methods.track", defaultStorage)); Map<String, String> getSplitStorageOptions();
map.put("uuid", getString("split-storage.methods.uuid", defaultStorage));
map.put("log", getString("split-storage.methods.log", defaultStorage));
return map;
}
} }

View File

@ -161,12 +161,12 @@ public abstract class PermissionHolder {
while (iterator.hasNext()) { while (iterator.hasNext()) {
Node node = iterator.next(); 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(); iterator.remove();
continue; continue;
} }
if (!node.shouldApplyOnWorld(context.getWorld(), context.isApplyGlobalWorldGroups(), plugin.getConfiguration().getApplyRegex())) { if (!node.shouldApplyOnWorld(context.getWorld(), context.isApplyGlobalWorldGroups(), plugin.getConfiguration().isApplyingRegex())) {
iterator.remove(); iterator.remove();
continue; continue;
} }
@ -214,11 +214,11 @@ public abstract class PermissionHolder {
all: all:
for (Node node : allNodes) { 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; continue;
} }
if (!node.shouldApplyOnWorld(context.getWorld(), context.isIncludeGlobalWorld(), plugin.getConfiguration().getApplyRegex())) { if (!node.shouldApplyOnWorld(context.getWorld(), context.isIncludeGlobalWorld(), plugin.getConfiguration().isApplyingRegex())) {
continue; continue;
} }
@ -251,7 +251,7 @@ public abstract class PermissionHolder {
for (Node node : getAllNodesFiltered(context)) { for (Node node : getAllNodesFiltered(context)) {
if (possibleNodes != null && !possibleNodes.isEmpty()) { if (possibleNodes != null && !possibleNodes.isEmpty()) {
if (node.getPermission().equals("*") || node.getPermission().equals("'*'")) { if (node.getPermission().equals("*") || node.getPermission().equals("'*'")) {
if (plugin.getConfiguration().getApplyWildcards()) { if (plugin.getConfiguration().isApplyingWildcards()) {
possibleNodes.forEach(n -> perms.put(n, true)); possibleNodes.forEach(n -> perms.put(n, true));
} }
} }
@ -259,14 +259,14 @@ public abstract class PermissionHolder {
perms.put(node.getPermission(), node.getValue()); perms.put(node.getPermission(), node.getValue());
if (plugin.getConfiguration().getApplyShorthand()) { if (plugin.getConfiguration().isApplyingShorthand()) {
node.resolveShorthand().stream() node.resolveShorthand().stream()
.filter(s -> !perms.containsKey(s)) .filter(s -> !perms.containsKey(s))
.forEach(s -> perms.put(s, node.getValue())); .forEach(s -> perms.put(s, node.getValue()));
} }
if (possibleNodes != null && !possibleNodes.isEmpty()) { if (possibleNodes != null && !possibleNodes.isEmpty()) {
if (plugin.getConfiguration().getApplyWildcards()) { if (plugin.getConfiguration().isApplyingWildcards()) {
node.resolveWildcard(possibleNodes).stream() node.resolveWildcard(possibleNodes).stream()
.filter(s -> !perms.containsKey(s)) .filter(s -> !perms.containsKey(s))
.forEach(s -> perms.put(s, node.getValue())); .forEach(s -> perms.put(s, node.getValue()));
@ -552,12 +552,12 @@ public abstract class PermissionHolder {
*/ */
@Deprecated @Deprecated
public Map<String, Boolean> getLocalPermissions(String server, String world, List<String> excludedGroups, List<String> possibleNodes) { public Map<String, Boolean> getLocalPermissions(String server, String world, List<String> excludedGroups, List<String> 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 @Deprecated
public Map<String, Boolean> getLocalPermissions(String server, String world, List<String> excludedGroups) { public Map<String, Boolean> getLocalPermissions(String server, String world, List<String> 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") @SuppressWarnings("deprecation")

View File

@ -50,7 +50,7 @@ public class LogEntry extends me.lucko.luckperms.api.LogEntry {
plugin.getDatastore().logAction(this); plugin.getDatastore().logAction(this);
LogNotifyEvent event = new LogNotifyEvent(this); LogNotifyEvent event = new LogNotifyEvent(this);
event.setCancelled(!plugin.getConfiguration().getLogNotify()); event.setCancelled(!plugin.getConfiguration().isLogNotify());
plugin.getApiProvider().fireEvent(event); plugin.getApiProvider().fireEvent(event);
if (event.isCancelled()) return; if (event.isCancelled()) return;

View File

@ -58,6 +58,15 @@ public class Group extends PermissionHolder implements Identifiable<String> {
return name; 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 * check to see if a group inherits a group
* @param group The group to check membership of * @param group The group to check membership of

View File

@ -37,16 +37,14 @@ import java.util.Set;
public class StorageFactory { public class StorageFactory {
private static final Set<String> TYPES = ImmutableSet.of("json", "yaml", "flatfile", "mongodb", "mysql", "sqlite", "h2"); private static final Set<String> TYPES = ImmutableSet.of("json", "yaml", "flatfile", "mongodb", "mysql", "sqlite", "h2");
@SuppressWarnings("unchecked")
public static Datastore getDatastore(LuckPermsPlugin plugin, String defaultMethod) { public static Datastore getDatastore(LuckPermsPlugin plugin, String defaultMethod) {
Datastore datastore; Datastore datastore;
plugin.getLog().info("Detecting storage method..."); plugin.getLog().info("Detecting storage method...");
if (plugin.getConfiguration().getSplitStorage()) { if (plugin.getConfiguration().isSplitStorage()) {
plugin.getLog().info("Using split storage."); plugin.getLog().info("Using split storage.");
// java sucks Map<String, String> types = plugin.getConfiguration().getSplitStorageOptions();
Map<String, String> types = (Map<String, String>) plugin.getConfiguration().getSplitStorageOptions();
types.entrySet().stream() types.entrySet().stream()
.filter(e -> !TYPES.contains(e.getValue().toLowerCase())) .filter(e -> !TYPES.contains(e.getValue().toLowerCase()))

View File

@ -37,11 +37,11 @@ public class Contexts {
configuration.getServer(), configuration.getServer(),
null, null,
Collections.emptyMap(), Collections.emptyMap(),
configuration.getIncludeGlobalPerms(), configuration.isIncludingGlobalPerms(),
configuration.getIncludeGlobalWorldPerms(), configuration.isIncludingGlobalWorldPerms(),
true, true,
configuration.getApplyGlobalGroups(), configuration.isApplyingGlobalGroups(),
configuration.getApplyGlobalWorldGroups() configuration.isApplyingGlobalWorldGroups()
); );
} }

View File

@ -115,7 +115,7 @@ public class LPSpongePlugin implements LuckPermsPlugin {
datastore = StorageFactory.getDatastore(this, "h2"); datastore = StorageFactory.getDatastore(this, "h2");
getLog().info("Loading internal permission managers..."); getLog().info("Loading internal permission managers...");
uuidCache = new UuidCache(getConfiguration().getOnlineMode()); uuidCache = new UuidCache(getConfiguration().isOnlineMode());
userManager = new SpongeUserManager(this); userManager = new SpongeUserManager(this);
groupManager = new GroupManager(this); groupManager = new GroupManager(this);
trackManager = new TrackManager(); trackManager = new TrackManager();

View File

@ -23,7 +23,7 @@
package me.lucko.luckperms; package me.lucko.luckperms;
import com.google.common.base.Splitter; 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.ConfigurationNode;
import ninja.leaping.configurate.commented.CommentedConfigurationNode; import ninja.leaping.configurate.commented.CommentedConfigurationNode;
import ninja.leaping.configurate.hocon.HoconConfigurationLoader; import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
@ -34,8 +34,10 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Map;
import java.util.stream.Collectors;
class SpongeConfig extends LPConfiguration<LPSpongePlugin> { class SpongeConfig extends AbstractConfiguration<LPSpongePlugin> {
private ConfigurationNode root; private ConfigurationNode root;
SpongeConfig(LPSpongePlugin plugin) { SpongeConfig(LPSpongePlugin plugin) {
@ -80,11 +82,6 @@ class SpongeConfig extends LPConfiguration<LPSpongePlugin> {
return node; return node;
} }
@Override
protected void set(String path, Object value) {
getNode(path).setValue(value);
}
@Override @Override
protected String getString(String path, String def) { protected String getString(String path, String def) {
return getNode(path).getString(def); return getNode(path).getString(def);
@ -99,4 +96,10 @@ class SpongeConfig extends LPConfiguration<LPSpongePlugin> {
protected boolean getBoolean(String path, boolean def) { protected boolean getBoolean(String path, boolean def) {
return getNode(path).getBoolean(def); return getNode(path).getBoolean(def);
} }
@Override
protected Map<String, String> getMap(String path, Map<String, String> def) {
ConfigurationNode node = getNode(path);
return node.getChildrenList().stream().collect(Collectors.toMap(n -> (String) n.getKey(), ConfigurationNode::getString));
}
} }

View File

@ -213,7 +213,7 @@ public class LuckPermsSubject implements Subject {
continue; 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; continue;
} }

View File

@ -56,16 +56,16 @@ public class LuckPermsUserSubject extends LuckPermsSubject {
List<PermissionProcessor> processors = new ArrayList<>(5); List<PermissionProcessor> processors = new ArrayList<>(5);
processors.add(new PermissionCalculator.MapProcessor(permissionCache)); processors.add(new PermissionCalculator.MapProcessor(permissionCache));
if (service.getPlugin().getConfiguration().getApplyWildcards()) { if (service.getPlugin().getConfiguration().isApplyingWildcards()) {
processors.add(new SpongeWildcardProcessor(permissionCache)); processors.add(new SpongeWildcardProcessor(permissionCache));
processors.add(new PermissionCalculator.WildcardProcessor(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 PermissionCalculator.RegexProcessor(permissionCache));
} }
processors.add(new SpongeDefaultsProcessor(service)); 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() { public void invalidateCache() {

View File

@ -59,11 +59,11 @@ class SpongeUser extends User {
plugin.getConfiguration().getServer(), plugin.getConfiguration().getServer(),
null, // TODO per world perms null, // TODO per world perms
null, null,
plugin.getConfiguration().getIncludeGlobalPerms(), plugin.getConfiguration().isIncludingGlobalPerms(),
plugin.getConfiguration().getIncludeGlobalWorldPerms(), plugin.getConfiguration().isIncludingGlobalWorldPerms(),
true, true,
plugin.getConfiguration().getApplyGlobalGroups(), plugin.getConfiguration().isApplyingGlobalGroups(),
plugin.getConfiguration().getApplyGlobalWorldGroups() plugin.getConfiguration().isApplyingGlobalWorldGroups()
), ),
Collections.emptyList() Collections.emptyList()
); );

View File

@ -55,6 +55,18 @@ debug-permission-checks=false
# If the plugin should send log notifications to users whenever permissions are modified. # If the plugin should send log notifications to users whenever permissions are modified.
log-notify=true 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. # Which storage method the plugin should use.
# Currently supported: mysql, sqlite, h2, json, yaml, mongodb # Currently supported: mysql, sqlite, h2, json, yaml, mongodb
# Fill out connection info below if you're using MySQL or MongoDB # Fill out connection info below if you're using MySQL or MongoDB

View File

@ -22,9 +22,11 @@
package me.lucko.luckperms.internal; package me.lucko.luckperms.internal;
import me.lucko.luckperms.core.LPConfiguration; import me.lucko.luckperms.core.AbstractConfiguration;
public class StandaloneConfiguration extends LPConfiguration<StandaloneBase> { import java.util.Map;
public class StandaloneConfiguration extends AbstractConfiguration<StandaloneBase> {
public StandaloneConfiguration(StandaloneBase plugin) { public StandaloneConfiguration(StandaloneBase plugin) {
super(plugin, "global", true, "null"); super(plugin, "global", true, "null");
} }
@ -33,11 +35,6 @@ public class StandaloneConfiguration extends LPConfiguration<StandaloneBase> {
protected void init() { protected void init() {
} }
@Override
protected void set(String path, Object value) {
}
@Override @Override
protected String getString(String path, String def) { protected String getString(String path, String def) {
return def; return def;
@ -52,4 +49,9 @@ public class StandaloneConfiguration extends LPConfiguration<StandaloneBase> {
protected boolean getBoolean(String path, boolean def) { protected boolean getBoolean(String path, boolean def) {
return def; return def;
} }
@Override
protected Map<String, String> getMap(String path, Map<String, String> def) {
return def;
}
} }