mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 11:38:40 +01:00
Add world and group name rewriting, refactor configs
This commit is contained in:
parent
12cd4e19cb
commit
f48595b1ff
@ -22,14 +22,17 @@
|
||||
|
||||
package me.lucko.luckperms;
|
||||
|
||||
import me.lucko.luckperms.core.LPConfiguration;
|
||||
import me.lucko.luckperms.core.AbstractConfiguration;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
class BukkitConfig extends LPConfiguration<LPBukkitPlugin> {
|
||||
class BukkitConfig extends AbstractConfiguration<LPBukkitPlugin> {
|
||||
private YamlConfiguration configuration;
|
||||
|
||||
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
|
||||
protected String getString(String path, String def) {
|
||||
return configuration.getString(path, def);
|
||||
@ -74,4 +72,20 @@ class BukkitConfig extends LPConfiguration<LPBukkitPlugin> {
|
||||
protected boolean getBoolean(String path, boolean 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;
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class BukkitListener extends AbstractListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerCommand(PlayerCommandPreprocessEvent e) {
|
||||
if (plugin.getConfiguration().getEnableOps()) {
|
||||
if (plugin.getConfiguration().isOpsEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
datastore = StorageFactory.getDatastore(this, "h2");
|
||||
|
||||
getLog().info("Loading internal permission managers...");
|
||||
uuidCache = new UuidCache(getConfiguration().getOnlineMode());
|
||||
uuidCache = new UuidCache(getConfiguration().isOnlineMode());
|
||||
userManager = new BukkitUserManager(this);
|
||||
groupManager = new GroupManager(this);
|
||||
trackManager = new TrackManager();
|
||||
@ -139,8 +139,8 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
registerPermissions(getConfiguration().getCommandsAllowOp() ? PermissionDefault.OP : PermissionDefault.FALSE);
|
||||
if (!getConfiguration().getEnableOps()) {
|
||||
registerPermissions(getConfiguration().isCommandsAllowOp() ? PermissionDefault.OP : PermissionDefault.FALSE);
|
||||
if (!getConfiguration().isOpsEnabled()) {
|
||||
getServer().getOperators().forEach(o -> o.setOp(false));
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class VaultHook {
|
||||
}
|
||||
permissionHook.setPlugin(plugin);
|
||||
permissionHook.setServer(plugin.getConfiguration().getVaultServer());
|
||||
permissionHook.setIncludeGlobal(plugin.getConfiguration().getVaultIncludeGlobal());
|
||||
permissionHook.setIncludeGlobal(plugin.getConfiguration().isVaultIncludingGlobal());
|
||||
|
||||
if (chatHook == null) {
|
||||
chatHook = new VaultChatHook(permissionHook);
|
||||
|
@ -62,15 +62,15 @@ public class LPPermissible extends PermissibleBase {
|
||||
List<PermissionProcessor> processors = new ArrayList<>(5);
|
||||
processors.add(new PermissionCalculator.MapProcessor(luckPermsPermissions));
|
||||
processors.add(new AttachmentProcessor(attachmentPermissions));
|
||||
if (plugin.getConfiguration().getApplyWildcards()) {
|
||||
if (plugin.getConfiguration().isApplyingWildcards()) {
|
||||
processors.add(new PermissionCalculator.WildcardProcessor(luckPermsPermissions));
|
||||
}
|
||||
if (plugin.getConfiguration().getApplyRegex()) {
|
||||
if (plugin.getConfiguration().isApplyingRegex()) {
|
||||
processors.add(new PermissionCalculator.RegexProcessor(luckPermsPermissions));
|
||||
}
|
||||
processors.add(new BukkitDefaultsProcessor(parent::isOp, defaultsProvider));
|
||||
|
||||
calculator = new PermissionCalculator(plugin, parent.getName(), plugin.getConfiguration().getDebugPermissionChecks(), processors);
|
||||
calculator = new PermissionCalculator(plugin, parent.getName(), plugin.getConfiguration().isDebugPermissionChecks(), processors);
|
||||
|
||||
recalculatePermissions();
|
||||
}
|
||||
|
@ -60,16 +60,17 @@ public class BukkitUser extends User {
|
||||
}
|
||||
|
||||
// Calculate the permissions that should be applied. This is done async, who cares about how long it takes or how often it's done.
|
||||
String world = plugin.getUserManager().getWorldCache().get(getUuid());
|
||||
Map<String, Boolean> toApply = exportNodes(
|
||||
new Contexts(
|
||||
getPlugin().getConfiguration().getServer(),
|
||||
plugin.getUserManager().getWorldCache().get(getUuid()),
|
||||
getPlugin().getConfiguration().getWorldRewrites().getOrDefault(world, world),
|
||||
null,
|
||||
getPlugin().getConfiguration().getIncludeGlobalPerms(),
|
||||
getPlugin().getConfiguration().getIncludeGlobalWorldPerms(),
|
||||
getPlugin().getConfiguration().isIncludingGlobalPerms(),
|
||||
getPlugin().getConfiguration().isIncludingGlobalWorldPerms(),
|
||||
true,
|
||||
getPlugin().getConfiguration().getApplyGlobalGroups(),
|
||||
getPlugin().getConfiguration().getApplyGlobalWorldGroups()
|
||||
getPlugin().getConfiguration().isApplyingGlobalGroups(),
|
||||
getPlugin().getConfiguration().isApplyingGlobalWorldGroups()
|
||||
),
|
||||
Collections.emptyList()
|
||||
);
|
||||
@ -96,7 +97,7 @@ public class BukkitUser extends User {
|
||||
lpPermissible.invalidateCache();
|
||||
existing.putAll(toApply);
|
||||
|
||||
if (plugin.getConfiguration().getAutoOp()) {
|
||||
if (plugin.getConfiguration().isAutoOp()) {
|
||||
boolean op = false;
|
||||
|
||||
for (Map.Entry<String, Boolean> e : toApply.entrySet()) {
|
||||
|
@ -55,7 +55,7 @@ public class BukkitUserManager extends UserManager {
|
||||
u.setLpPermissible(null);
|
||||
}
|
||||
|
||||
if (plugin.getConfiguration().getAutoOp()) {
|
||||
if (plugin.getConfiguration().isAutoOp()) {
|
||||
player.setOp(false);
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +80,16 @@ vault-server: global
|
||||
# If global permissions should be considered when retrieving meta or player groups
|
||||
vault-include-global: true
|
||||
|
||||
# Mirrors world names. Whenever LuckPerms checks what world a user is in, if the world name is in this list, the value assigned
|
||||
# will be sent forward for permission calculation instead.
|
||||
world-rewrite:
|
||||
#world_nether: world
|
||||
#world_the_end: world
|
||||
|
||||
# Rewrites group names. The underlying name of the group does not change, just the output in commands / placeholders / Vault.
|
||||
group-name-rewrite:
|
||||
#default: Member
|
||||
|
||||
# Which storage method the plugin should use.
|
||||
# Currently supported: mysql, sqlite, h2, json, yaml, mongodb
|
||||
# Fill out connection info below if you're using MySQL or MongoDB
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
package me.lucko.luckperms;
|
||||
|
||||
import me.lucko.luckperms.core.LPConfiguration;
|
||||
import me.lucko.luckperms.core.AbstractConfiguration;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.config.ConfigurationProvider;
|
||||
import net.md_5.bungee.config.YamlConfiguration;
|
||||
@ -31,8 +31,9 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Map;
|
||||
|
||||
class BungeeConfig extends LPConfiguration<LPBungeePlugin> {
|
||||
class BungeeConfig extends AbstractConfiguration<LPBungeePlugin> {
|
||||
private Configuration configuration;
|
||||
|
||||
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
|
||||
protected String getString(String path, String def) {
|
||||
return configuration.getString(path, def);
|
||||
@ -81,4 +77,9 @@ class BungeeConfig extends LPConfiguration<LPBungeePlugin> {
|
||||
protected boolean getBoolean(String path, boolean def) {
|
||||
return configuration.getBoolean(path, def);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getMap(String path, Map<String, String> def) {
|
||||
return configuration.get(path, def);
|
||||
}
|
||||
}
|
||||
|
@ -41,14 +41,14 @@ public class BungeePlayerCache {
|
||||
public BungeePlayerCache(LuckPermsPlugin plugin, String name) {
|
||||
List<PermissionProcessor> processors = new ArrayList<>(3);
|
||||
processors.add(new PermissionCalculator.MapProcessor(permissions));
|
||||
if (plugin.getConfiguration().getApplyWildcards()) {
|
||||
if (plugin.getConfiguration().isApplyingWildcards()) {
|
||||
processors.add(new PermissionCalculator.WildcardProcessor(permissions));
|
||||
}
|
||||
if (plugin.getConfiguration().getApplyRegex()) {
|
||||
if (plugin.getConfiguration().isApplyingRegex()) {
|
||||
processors.add(new PermissionCalculator.RegexProcessor(permissions));
|
||||
}
|
||||
|
||||
calculator = new PermissionCalculator(plugin, name, plugin.getConfiguration().getDebugPermissionChecks(), processors);
|
||||
calculator = new PermissionCalculator(plugin, name, plugin.getConfiguration().isDebugPermissionChecks(), processors);
|
||||
}
|
||||
|
||||
public void invalidateCache() {
|
||||
|
@ -88,7 +88,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
|
||||
datastore = StorageFactory.getDatastore(this, "h2");
|
||||
|
||||
getLog().info("Loading internal permission managers...");
|
||||
uuidCache = new UuidCache(getConfiguration().getOnlineMode());
|
||||
uuidCache = new UuidCache(getConfiguration().isOnlineMode());
|
||||
userManager = new BungeeUserManager(this);
|
||||
groupManager = new GroupManager(this);
|
||||
trackManager = new TrackManager();
|
||||
|
@ -64,13 +64,13 @@ public class BungeeUser extends User {
|
||||
Map<String, Boolean> toApply = exportNodes(
|
||||
new Contexts(
|
||||
plugin.getConfiguration().getServer(),
|
||||
server,
|
||||
plugin.getConfiguration().getWorldRewrites().getOrDefault(server, server),
|
||||
null,
|
||||
plugin.getConfiguration().getIncludeGlobalPerms(),
|
||||
plugin.getConfiguration().getIncludeGlobalWorldPerms(),
|
||||
plugin.getConfiguration().isIncludingGlobalPerms(),
|
||||
plugin.getConfiguration().isIncludingGlobalWorldPerms(),
|
||||
true,
|
||||
plugin.getConfiguration().getApplyGlobalGroups(),
|
||||
plugin.getConfiguration().getApplyGlobalWorldGroups()
|
||||
plugin.getConfiguration().isApplyingGlobalGroups(),
|
||||
plugin.getConfiguration().isApplyingGlobalWorldGroups()
|
||||
),
|
||||
Collections.emptyList()
|
||||
);
|
||||
|
@ -59,6 +59,18 @@ log-notify: true
|
||||
# If LuckPerms should print to console every time a plugin checks if a player has a permission
|
||||
debug-permission-checks: false
|
||||
|
||||
# Mirrors world names. Whenever LuckPerms checks what world a user is in, if the world name is in this list, the value assigned
|
||||
# will be sent forward for permission calculation instead.
|
||||
# Remember world names on BungeeCord relate to the backend server name a user is connected to.
|
||||
world-rewrite:
|
||||
#hub2: hub
|
||||
#hub3: hub
|
||||
#opfactions: factions
|
||||
|
||||
# Rewrites group names. The underlying name of the group does not change, just the output in commands / placeholders / Vault.
|
||||
group-name-rewrite:
|
||||
#default: Member
|
||||
|
||||
# Which storage method the plugin should use.
|
||||
# Currently supported: mysql, sqlite, h2, json, yaml, mongodb
|
||||
# Fill out connection info below if you're using MySQL or MongoDB
|
||||
|
@ -58,67 +58,67 @@ public class LPConfigurationLink implements LPConfiguration {
|
||||
|
||||
@Override
|
||||
public boolean getIncludeGlobalPerms() {
|
||||
return master.getIncludeGlobalPerms();
|
||||
return master.isIncludingGlobalPerms();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIncludeGlobalWorldPerms() {
|
||||
return master.getIncludeGlobalWorldPerms();
|
||||
return master.isIncludingGlobalWorldPerms();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getApplyGlobalGroups() {
|
||||
return master.getApplyGlobalGroups();
|
||||
return master.isApplyingGlobalGroups();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getApplyGlobalWorldGroups() {
|
||||
return master.getApplyGlobalWorldGroups();
|
||||
return master.isApplyingGlobalWorldGroups();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getOnlineMode() {
|
||||
return master.getOnlineMode();
|
||||
return master.isOnlineMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getApplyWildcards() {
|
||||
return master.getApplyWildcards();
|
||||
return master.isApplyingWildcards();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getApplyRegex() {
|
||||
return master.getApplyRegex();
|
||||
return master.isApplyingRegex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getApplyShorthand() {
|
||||
return master.getApplyShorthand();
|
||||
return master.isApplyingShorthand();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getLogNotify() {
|
||||
return master.getLogNotify();
|
||||
return master.isLogNotify();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getDebugPermissionChecks() {
|
||||
return master.getDebugPermissionChecks();
|
||||
return master.isDebugPermissionChecks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getEnableOps() {
|
||||
return master.getEnableOps();
|
||||
return master.isOpsEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getCommandsAllowOp() {
|
||||
return master.getCommandsAllowOp();
|
||||
return master.isCommandsAllowOp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getAutoOp() {
|
||||
return master.getAutoOp();
|
||||
return master.isAutoOp();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,7 +128,7 @@ public class LPConfigurationLink implements LPConfiguration {
|
||||
|
||||
@Override
|
||||
public boolean getVaultIncludeGlobal() {
|
||||
return master.getVaultIncludeGlobal();
|
||||
return master.isVaultIncludingGlobal();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -149,10 +149,9 @@ public class LPConfigurationLink implements LPConfiguration {
|
||||
|
||||
@Override
|
||||
public boolean getSplitStorage() {
|
||||
return master.getSplitStorage();
|
||||
return master.isSplitStorage();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Map<String, String> getSplitStorageOptions() {
|
||||
return master.getSplitStorageOptions();
|
||||
|
@ -71,7 +71,7 @@ public class DeleteGroup extends SingleMainCommand {
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
Message.DELETE_SUCCESS.send(sender, groupName);
|
||||
Message.DELETE_SUCCESS.send(sender, group.getDisplayName());
|
||||
LogEntry.build().actor(sender).actedName(groupName).type('G').action("delete").build().submit(plugin, sender);
|
||||
plugin.runUpdateTask();
|
||||
return CommandResult.SUCCESS;
|
||||
|
@ -29,9 +29,11 @@ import me.lucko.luckperms.commands.SingleMainCommand;
|
||||
import me.lucko.luckperms.commands.Util;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ListGroups extends SingleMainCommand {
|
||||
public ListGroups() {
|
||||
@ -45,7 +47,13 @@ public class ListGroups extends SingleMainCommand {
|
||||
return CommandResult.LOADING_ERROR;
|
||||
}
|
||||
|
||||
Message.GROUPS_LIST.send(sender, Util.listToCommaSep(new ArrayList<>(plugin.getGroupManager().getAll().keySet())));
|
||||
Message.GROUPS_LIST.send(
|
||||
sender,
|
||||
Util.listToCommaSep(new ArrayList<>(plugin.getGroupManager().getAll().values().stream()
|
||||
.map(Group::getDisplayName)
|
||||
.collect(Collectors.toList()))
|
||||
)
|
||||
);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -65,14 +65,14 @@ public class GroupAddPrefix extends SubCommand<Group> {
|
||||
|
||||
if (args.size() == 3) {
|
||||
group.setPermission(node, true, server);
|
||||
Message.ADDPREFIX_SERVER_SUCCESS.send(sender, group.getName(), prefix, priority, server);
|
||||
Message.ADDPREFIX_SERVER_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, server);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("addprefix " + priority + " " + args.get(1) + " " + server)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
final String world = args.get(3).toLowerCase();
|
||||
group.setPermission(node, true, server, world);
|
||||
Message.ADDPREFIX_SERVER_WORLD_SUCCESS.send(sender, group.getName(), prefix, priority, server, world);
|
||||
Message.ADDPREFIX_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, server, world);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("addprefix " + priority + " " + args.get(1) + " " + server + " " + world)
|
||||
.build().submit(plugin, sender);
|
||||
@ -80,7 +80,7 @@ public class GroupAddPrefix extends SubCommand<Group> {
|
||||
|
||||
} else {
|
||||
group.setPermission(node, true);
|
||||
Message.ADDPREFIX_SUCCESS.send(sender, group.getName(), prefix, priority);
|
||||
Message.ADDPREFIX_SUCCESS.send(sender, group.getDisplayName(), prefix, priority);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("addprefix " + priority + " " + args.get(1))
|
||||
.build().submit(plugin, sender);
|
||||
@ -89,7 +89,7 @@ public class GroupAddPrefix extends SubCommand<Group> {
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectAlreadyHasException e) {
|
||||
Message.ALREADY_HAS_PREFIX.send(sender, group.getName());
|
||||
Message.ALREADY_HAS_PREFIX.send(sender, group.getDisplayName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -65,14 +65,14 @@ public class GroupAddSuffix extends SubCommand<Group> {
|
||||
|
||||
if (args.size() == 3) {
|
||||
group.setPermission(node, true, server);
|
||||
Message.ADDSUFFIX_SERVER_SUCCESS.send(sender, group.getName(), suffix, priority, server);
|
||||
Message.ADDSUFFIX_SERVER_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, server);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("addsuffix " + priority + " " + args.get(1) + " " + server)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
final String world = args.get(3).toLowerCase();
|
||||
group.setPermission(node, true, server, world);
|
||||
Message.ADDSUFFIX_SERVER_WORLD_SUCCESS.send(sender, group.getName(), suffix, priority, server, world);
|
||||
Message.ADDSUFFIX_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, server, world);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("addsuffix " + priority + " " + args.get(1) + " " + server + " " + world)
|
||||
.build().submit(plugin, sender);
|
||||
@ -80,7 +80,7 @@ public class GroupAddSuffix extends SubCommand<Group> {
|
||||
|
||||
} else {
|
||||
group.setPermission(node, true);
|
||||
Message.ADDSUFFIX_SUCCESS.send(sender, group.getName(), suffix, priority);
|
||||
Message.ADDSUFFIX_SUCCESS.send(sender, group.getDisplayName(), suffix, priority);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("addsuffix " + priority + " " + args.get(1))
|
||||
.build().submit(plugin, sender);
|
||||
@ -89,7 +89,7 @@ public class GroupAddSuffix extends SubCommand<Group> {
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectAlreadyHasException e) {
|
||||
Message.ALREADY_HAS_SUFFIX.send(sender, group.getName());
|
||||
Message.ALREADY_HAS_SUFFIX.send(sender, group.getDisplayName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -83,14 +83,14 @@ public class GroupAddTempPrefix extends SubCommand<Group> {
|
||||
|
||||
if (args.size() == 4) {
|
||||
group.setPermission(node, true, server, duration);
|
||||
Message.ADD_TEMP_PREFIX_SERVER_SUCCESS.send(sender, group.getName(), prefix, priority, server, DateUtil.formatDateDiff(duration));
|
||||
Message.ADD_TEMP_PREFIX_SERVER_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, server, DateUtil.formatDateDiff(duration));
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("addtempprefix " + priority + " " + args.get(1) + " " + duration + " " + server)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
final String world = args.get(4).toLowerCase();
|
||||
group.setPermission(node, true, server, world, duration);
|
||||
Message.ADD_TEMP_PREFIX_SERVER_WORLD_SUCCESS.send(sender, group.getName(), prefix, priority, server, world, DateUtil.formatDateDiff(duration));
|
||||
Message.ADD_TEMP_PREFIX_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, server, world, DateUtil.formatDateDiff(duration));
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("addtempprefix " + priority + " " + args.get(1) + " " + duration + " " + server + " " + world)
|
||||
.build().submit(plugin, sender);
|
||||
@ -98,7 +98,7 @@ public class GroupAddTempPrefix extends SubCommand<Group> {
|
||||
|
||||
} else {
|
||||
group.setPermission(node, true, duration);
|
||||
Message.ADD_TEMP_PREFIX_SUCCESS.send(sender, group.getName(), prefix, priority, DateUtil.formatDateDiff(duration));
|
||||
Message.ADD_TEMP_PREFIX_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, DateUtil.formatDateDiff(duration));
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("addtempprefix " + priority + " " + args.get(1) + " " + duration)
|
||||
.build().submit(plugin, sender);
|
||||
@ -107,7 +107,7 @@ public class GroupAddTempPrefix extends SubCommand<Group> {
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectAlreadyHasException e) {
|
||||
Message.ALREADY_HAS_PREFIX.send(sender, group.getName());
|
||||
Message.ALREADY_HAS_PREFIX.send(sender, group.getDisplayName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -83,14 +83,14 @@ public class GroupAddTempSuffix extends SubCommand<Group> {
|
||||
|
||||
if (args.size() == 4) {
|
||||
group.setPermission(node, true, server, duration);
|
||||
Message.ADD_TEMP_SUFFIX_SERVER_SUCCESS.send(sender, group.getName(), suffix, priority, server, DateUtil.formatDateDiff(duration));
|
||||
Message.ADD_TEMP_SUFFIX_SERVER_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, server, DateUtil.formatDateDiff(duration));
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("addtempsuffix " + priority + " " + args.get(1) + " " + duration + " " + server)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
final String world = args.get(4).toLowerCase();
|
||||
group.setPermission(node, true, server, world, duration);
|
||||
Message.ADD_TEMP_SUFFIX_SERVER_WORLD_SUCCESS.send(sender, group.getName(), suffix, priority, server, world, DateUtil.formatDateDiff(duration));
|
||||
Message.ADD_TEMP_SUFFIX_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, server, world, DateUtil.formatDateDiff(duration));
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("addtempsuffix " + priority + " " + args.get(1) + " " + duration + " " + server + " " + world)
|
||||
.build().submit(plugin, sender);
|
||||
@ -98,7 +98,7 @@ public class GroupAddTempSuffix extends SubCommand<Group> {
|
||||
|
||||
} else {
|
||||
group.setPermission(node, true, duration);
|
||||
Message.ADD_TEMP_SUFFIX_SUCCESS.send(sender, group.getName(), suffix, priority, DateUtil.formatDateDiff(duration));
|
||||
Message.ADD_TEMP_SUFFIX_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, DateUtil.formatDateDiff(duration));
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("addtempsuffix " + priority + " " + args.get(1) + " " + duration)
|
||||
.build().submit(plugin, sender);
|
||||
@ -107,7 +107,7 @@ public class GroupAddTempSuffix extends SubCommand<Group> {
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectAlreadyHasException e) {
|
||||
Message.ALREADY_HAS_SUFFIX.send(sender, group.getName());
|
||||
Message.ALREADY_HAS_SUFFIX.send(sender, group.getDisplayName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -68,18 +68,18 @@ public class GroupChatMeta extends SubCommand<Group> {
|
||||
}
|
||||
|
||||
if (prefixes.isEmpty()) {
|
||||
Message.CHAT_META_PREFIX_NONE.send(sender, group.getName());
|
||||
Message.CHAT_META_PREFIX_NONE.send(sender, group.getDisplayName());
|
||||
} else {
|
||||
Message.CHAT_META_PREFIX_HEADER.send(sender, group.getName());
|
||||
Message.CHAT_META_PREFIX_HEADER.send(sender, group.getDisplayName());
|
||||
for (Map.Entry<Integer, String> e : prefixes) {
|
||||
Message.CHAT_META_ENTRY.send(sender, e.getKey(), e.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if (suffixes.isEmpty()) {
|
||||
Message.CHAT_META_SUFFIX_NONE.send(sender, group.getName());
|
||||
Message.CHAT_META_SUFFIX_NONE.send(sender, group.getDisplayName());
|
||||
} else {
|
||||
Message.CHAT_META_SUFFIX_HEADER.send(sender, group.getName());
|
||||
Message.CHAT_META_SUFFIX_HEADER.send(sender, group.getDisplayName());
|
||||
for (Map.Entry<Integer, String> e : suffixes) {
|
||||
Message.CHAT_META_ENTRY.send(sender, e.getKey(), e.getValue());
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class GroupClear extends SubCommand<Group> {
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
|
||||
group.clearNodes();
|
||||
Message.CLEAR_SUCCESS.send(sender, group.getName());
|
||||
Message.CLEAR_SUCCESS.send(sender, group.getDisplayName());
|
||||
LogEntry.build().actor(sender).acted(group).action("clear").build().submit(plugin, sender);
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
|
@ -42,12 +42,13 @@ public class GroupInfo extends SubCommand<Group> {
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
|
||||
Message.GROUP_INFO.send(sender,
|
||||
group.getName(),
|
||||
group.getDisplayName(),
|
||||
group.getPermanentNodes().size(),
|
||||
group.getTemporaryNodes().size(),
|
||||
label,
|
||||
group.getName()
|
||||
);
|
||||
// TODO show inheritances
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -38,8 +38,8 @@ public class GroupListNodes extends SubCommand<Group> {
|
||||
|
||||
@Override
|
||||
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_TEMP.send(sender, group.getName(), Util.tempNodesToString(group.getPermissions(false)));
|
||||
Message.LISTNODES.send(sender, group.getDisplayName(), Util.permNodesToString(group.getPermissions(false)));
|
||||
Message.LISTNODES_TEMP.send(sender, group.getDisplayName(), Util.tempNodesToString(group.getPermissions(false)));
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -65,14 +65,14 @@ public class GroupRemovePrefix extends SubCommand<Group> {
|
||||
|
||||
if (args.size() == 3) {
|
||||
group.unsetPermission(node, server);
|
||||
Message.REMOVEPREFIX_SERVER_SUCCESS.send(sender, group.getName(), prefix, priority, server);
|
||||
Message.REMOVEPREFIX_SERVER_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, server);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("removeprefix " + priority + " " + args.get(1) + " " + server)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
final String world = args.get(3).toLowerCase();
|
||||
group.unsetPermission(node, server, world);
|
||||
Message.REMOVEPREFIX_SERVER_WORLD_SUCCESS.send(sender, group.getName(), prefix, priority, server, world);
|
||||
Message.REMOVEPREFIX_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, server, world);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("removeprefix " + priority + " " + args.get(1) + " " + server + " " + world)
|
||||
.build().submit(plugin, sender);
|
||||
@ -80,7 +80,7 @@ public class GroupRemovePrefix extends SubCommand<Group> {
|
||||
|
||||
} else {
|
||||
group.unsetPermission(node);
|
||||
Message.REMOVEPREFIX_SUCCESS.send(sender, group.getName(), prefix, priority);
|
||||
Message.REMOVEPREFIX_SUCCESS.send(sender, group.getDisplayName(), prefix, priority);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("removeprefix " + priority + " " + args.get(1))
|
||||
.build().submit(plugin, sender);
|
||||
@ -89,7 +89,7 @@ public class GroupRemovePrefix extends SubCommand<Group> {
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectLacksException e) {
|
||||
Message.DOES_NOT_HAVE_PREFIX.send(sender, group.getName());
|
||||
Message.DOES_NOT_HAVE_PREFIX.send(sender, group.getDisplayName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -65,14 +65,14 @@ public class GroupRemoveSuffix extends SubCommand<Group> {
|
||||
|
||||
if (args.size() == 3) {
|
||||
group.unsetPermission(node, server);
|
||||
Message.REMOVESUFFIX_SERVER_SUCCESS.send(sender, group.getName(), suffix, priority, server);
|
||||
Message.REMOVESUFFIX_SERVER_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, server);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("removesuffix " + priority + " " + args.get(1) + " " + server)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
final String world = args.get(3).toLowerCase();
|
||||
group.unsetPermission(node, server, world);
|
||||
Message.REMOVESUFFIX_SERVER_WORLD_SUCCESS.send(sender, group.getName(), suffix, priority, server, world);
|
||||
Message.REMOVESUFFIX_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, server, world);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("removesuffix " + priority + " " + args.get(1) + " " + server + " " + world)
|
||||
.build().submit(plugin, sender);
|
||||
@ -80,7 +80,7 @@ public class GroupRemoveSuffix extends SubCommand<Group> {
|
||||
|
||||
} else {
|
||||
group.unsetPermission(node);
|
||||
Message.REMOVESUFFIX_SUCCESS.send(sender, group.getName(), suffix, priority);
|
||||
Message.REMOVESUFFIX_SUCCESS.send(sender, group.getDisplayName(), suffix, priority);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("removesuffix " + priority + " " + args.get(1))
|
||||
.build().submit(plugin, sender);
|
||||
@ -89,7 +89,7 @@ public class GroupRemoveSuffix extends SubCommand<Group> {
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectLacksException e) {
|
||||
Message.DOES_NOT_HAVE_SUFFIX.send(sender, group.getName());
|
||||
Message.DOES_NOT_HAVE_SUFFIX.send(sender, group.getDisplayName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -65,14 +65,14 @@ public class GroupRemoveTempPrefix extends SubCommand<Group> {
|
||||
|
||||
if (args.size() == 3) {
|
||||
group.unsetPermission(node, server, true);
|
||||
Message.REMOVE_TEMP_PREFIX_SERVER_SUCCESS.send(sender, group.getName(), prefix, priority, server);
|
||||
Message.REMOVE_TEMP_PREFIX_SERVER_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, server);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("removetempprefix " + priority + " " + args.get(1) + " " + server)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
final String world = args.get(3).toLowerCase();
|
||||
group.unsetPermission(node, server, world, true);
|
||||
Message.REMOVE_TEMP_PREFIX_SERVER_WORLD_SUCCESS.send(sender, group.getName(), prefix, priority, server, world);
|
||||
Message.REMOVE_TEMP_PREFIX_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), prefix, priority, server, world);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("removetempprefix " + priority + " " + args.get(1) + " " + server + " " + world)
|
||||
.build().submit(plugin, sender);
|
||||
@ -80,7 +80,7 @@ public class GroupRemoveTempPrefix extends SubCommand<Group> {
|
||||
|
||||
} else {
|
||||
group.unsetPermission(node, true);
|
||||
Message.REMOVE_TEMP_PREFIX_SUCCESS.send(sender, group.getName(), prefix, priority);
|
||||
Message.REMOVE_TEMP_PREFIX_SUCCESS.send(sender, group.getDisplayName(), prefix, priority);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("removetempprefix " + priority + " " + args.get(1))
|
||||
.build().submit(plugin, sender);
|
||||
@ -89,7 +89,7 @@ public class GroupRemoveTempPrefix extends SubCommand<Group> {
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectLacksException e) {
|
||||
Message.DOES_NOT_HAVE_PREFIX.send(sender, group.getName());
|
||||
Message.DOES_NOT_HAVE_PREFIX.send(sender, group.getDisplayName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -65,14 +65,14 @@ public class GroupRemoveTempSuffix extends SubCommand<Group> {
|
||||
|
||||
if (args.size() == 3) {
|
||||
group.unsetPermission(node, server, true);
|
||||
Message.REMOVE_TEMP_SUFFIX_SERVER_SUCCESS.send(sender, group.getName(), suffix, priority, server);
|
||||
Message.REMOVE_TEMP_SUFFIX_SERVER_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, server);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("removetempsuffix " + priority + " " + args.get(1) + " " + server)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
final String world = args.get(3).toLowerCase();
|
||||
group.unsetPermission(node, server, world, true);
|
||||
Message.REMOVE_TEMP_SUFFIX_SERVER_WORLD_SUCCESS.send(sender, group.getName(), suffix, priority, server, world);
|
||||
Message.REMOVE_TEMP_SUFFIX_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), suffix, priority, server, world);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("removetempsuffix " + priority + " " + args.get(1) + " " + server + " " + world)
|
||||
.build().submit(plugin, sender);
|
||||
@ -80,7 +80,7 @@ public class GroupRemoveTempSuffix extends SubCommand<Group> {
|
||||
|
||||
} else {
|
||||
group.unsetPermission(node, true);
|
||||
Message.REMOVE_TEMP_SUFFIX_SUCCESS.send(sender, group.getName(), suffix, priority);
|
||||
Message.REMOVE_TEMP_SUFFIX_SUCCESS.send(sender, group.getDisplayName(), suffix, priority);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("removetempsuffix " + priority + " " + args.get(1))
|
||||
.build().submit(plugin, sender);
|
||||
@ -89,7 +89,7 @@ public class GroupRemoveTempSuffix extends SubCommand<Group> {
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectLacksException e) {
|
||||
Message.DOES_NOT_HAVE_SUFFIX.send(sender, group.getName());
|
||||
Message.DOES_NOT_HAVE_SUFFIX.send(sender, group.getDisplayName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -73,14 +73,14 @@ public class GroupSetInherit extends SubCommand<Group> {
|
||||
|
||||
if (args.size() == 2) {
|
||||
group.setInheritGroup(group1, server);
|
||||
Message.GROUP_SETINHERIT_SERVER_SUCCESS.send(sender, group.getName(), group1.getName(), server);
|
||||
Message.GROUP_SETINHERIT_SERVER_SUCCESS.send(sender, group.getDisplayName(), group1.getDisplayName(), server);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("setinherit " + group1.getName() + " " + server)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
final String world = args.get(2).toLowerCase();
|
||||
group.setInheritGroup(group1, server, world);
|
||||
Message.GROUP_SETINHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getName(), group1.getName(), server, world);
|
||||
Message.GROUP_SETINHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), group1.getDisplayName(), server, world);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("setinherit " + group1.getName() + " " + server + " " + world)
|
||||
.build().submit(plugin, sender);
|
||||
@ -88,7 +88,7 @@ public class GroupSetInherit extends SubCommand<Group> {
|
||||
|
||||
} else {
|
||||
group.setInheritGroup(group1);
|
||||
Message.GROUP_SETINHERIT_SUCCESS.send(sender, group.getName(), group1.getName());
|
||||
Message.GROUP_SETINHERIT_SUCCESS.send(sender, group.getDisplayName(), group1.getDisplayName());
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("setinherit " + group1.getName())
|
||||
.build().submit(plugin, sender);
|
||||
@ -97,7 +97,7 @@ public class GroupSetInherit extends SubCommand<Group> {
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectAlreadyHasException e) {
|
||||
Message.GROUP_ALREADY_INHERITS.send(sender, group.getName(), group1.getName());
|
||||
Message.GROUP_ALREADY_INHERITS.send(sender, group.getDisplayName(), group1.getDisplayName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -74,14 +74,14 @@ public class GroupSetPermission extends SubCommand<Group> {
|
||||
|
||||
if (args.size() == 3) {
|
||||
group.setPermission(node, b, server);
|
||||
Message.SETPERMISSION_SERVER_SUCCESS.send(sender, node, bool, group.getName(), server);
|
||||
Message.SETPERMISSION_SERVER_SUCCESS.send(sender, node, bool, group.getDisplayName(), server);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("set " + node + " " + b + " " + server)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
final String world = args.get(3).toLowerCase();
|
||||
group.setPermission(node, b, server, world);
|
||||
Message.SETPERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, bool, group.getName(), server, world);
|
||||
Message.SETPERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, bool, group.getDisplayName(), server, world);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("set " + node + " " + b + " " + server + " " + world)
|
||||
.build().submit(plugin, sender);
|
||||
@ -89,7 +89,7 @@ public class GroupSetPermission extends SubCommand<Group> {
|
||||
|
||||
} else {
|
||||
group.setPermission(node, b);
|
||||
Message.SETPERMISSION_SUCCESS.send(sender, node, bool, group.getName());
|
||||
Message.SETPERMISSION_SUCCESS.send(sender, node, bool, group.getDisplayName());
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("set " + node + " " + b)
|
||||
.build().submit(plugin, sender);
|
||||
@ -98,7 +98,7 @@ public class GroupSetPermission extends SubCommand<Group> {
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectAlreadyHasException e) {
|
||||
Message.ALREADY_HASPERMISSION.send(sender, group.getName());
|
||||
Message.ALREADY_HASPERMISSION.send(sender, group.getDisplayName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class GroupSetTempInherit extends SubCommand<Group> {
|
||||
|
||||
if (args.size() == 3) {
|
||||
group.setInheritGroup(group1, server, duration);
|
||||
Message.GROUP_SET_TEMP_INHERIT_SERVER_SUCCESS.send(sender, group.getName(), group1.getName(), server,
|
||||
Message.GROUP_SET_TEMP_INHERIT_SERVER_SUCCESS.send(sender, group.getDisplayName(), group1.getDisplayName(), server,
|
||||
DateUtil.formatDateDiff(duration));
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("settempinherit " + group1.getName() + " " + duration + " " + server)
|
||||
@ -99,7 +99,7 @@ public class GroupSetTempInherit extends SubCommand<Group> {
|
||||
} else {
|
||||
final String world = args.get(3).toLowerCase();
|
||||
group.setInheritGroup(group1, server, world, duration);
|
||||
Message.GROUP_SET_TEMP_INHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getName(), group1.getName(), server,
|
||||
Message.GROUP_SET_TEMP_INHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), group1.getDisplayName(), server,
|
||||
world, DateUtil.formatDateDiff(duration));
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("settempinherit " + group1.getName() + " " + duration + " " + server + " " + world)
|
||||
@ -108,7 +108,7 @@ public class GroupSetTempInherit extends SubCommand<Group> {
|
||||
|
||||
} else {
|
||||
group.setInheritGroup(group1, duration);
|
||||
Message.GROUP_SET_TEMP_INHERIT_SUCCESS.send(sender, group.getName(), group1.getName(), DateUtil.formatDateDiff(duration));
|
||||
Message.GROUP_SET_TEMP_INHERIT_SUCCESS.send(sender, group.getDisplayName(), group1.getDisplayName(), DateUtil.formatDateDiff(duration));
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("settempinherit " + group1.getName() + " " + duration)
|
||||
.build().submit(plugin, sender);
|
||||
@ -117,7 +117,7 @@ public class GroupSetTempInherit extends SubCommand<Group> {
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectAlreadyHasException e) {
|
||||
Message.USER_ALREADY_TEMP_MEMBER_OF.send(sender, group.getName(), group1.getName());
|
||||
Message.USER_ALREADY_TEMP_MEMBER_OF.send(sender, group.getDisplayName(), group1.getDisplayName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class GroupSetTempPermission extends SubCommand<Group> {
|
||||
|
||||
if (args.size() == 4) {
|
||||
group.setPermission(node, b, server, duration);
|
||||
Message.SETPERMISSION_TEMP_SERVER_SUCCESS.send(sender, node, bool, group.getName(), server,
|
||||
Message.SETPERMISSION_TEMP_SERVER_SUCCESS.send(sender, node, bool, group.getDisplayName(), server,
|
||||
DateUtil.formatDateDiff(duration));
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("settemp " + node + " " + b + " " + duration + " " + server)
|
||||
@ -101,7 +101,7 @@ public class GroupSetTempPermission extends SubCommand<Group> {
|
||||
} else {
|
||||
final String world = args.get(4).toLowerCase();
|
||||
group.setPermission(node, b, server, world, duration);
|
||||
Message.SETPERMISSION_TEMP_SERVER_WORLD_SUCCESS.send(sender, node, bool, group.getName(), server,
|
||||
Message.SETPERMISSION_TEMP_SERVER_WORLD_SUCCESS.send(sender, node, bool, group.getDisplayName(), server,
|
||||
world, DateUtil.formatDateDiff(duration));
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("settemp " + node + " " + b + " " + duration + " " + server + " " + world)
|
||||
@ -110,7 +110,7 @@ public class GroupSetTempPermission extends SubCommand<Group> {
|
||||
|
||||
} else {
|
||||
group.setPermission(node, b, duration);
|
||||
Message.SETPERMISSION_TEMP_SUCCESS.send(sender, node, bool, group.getName(), DateUtil.formatDateDiff(duration));
|
||||
Message.SETPERMISSION_TEMP_SUCCESS.send(sender, node, bool, group.getDisplayName(), DateUtil.formatDateDiff(duration));
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("settemp " + node + " " + b + " " + duration)
|
||||
.build().submit(plugin, sender);
|
||||
@ -119,7 +119,7 @@ public class GroupSetTempPermission extends SubCommand<Group> {
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectAlreadyHasException e) {
|
||||
Message.ALREADY_HAS_TEMP_PERMISSION.send(sender, group.getName());
|
||||
Message.ALREADY_HAS_TEMP_PERMISSION.send(sender, group.getDisplayName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -66,14 +66,14 @@ public class GroupUnSetPermission extends SubCommand<Group> {
|
||||
|
||||
if (args.size() == 2) {
|
||||
group.unsetPermission(node, server);
|
||||
Message.UNSETPERMISSION_SERVER_SUCCESS.send(sender, node, group.getName(), server);
|
||||
Message.UNSETPERMISSION_SERVER_SUCCESS.send(sender, node, group.getDisplayName(), server);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("unset " + node + " " + server)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
final String world = args.get(2).toLowerCase();
|
||||
group.unsetPermission(node, server, world);
|
||||
Message.UNSETPERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, group.getName(), server, world);
|
||||
Message.UNSETPERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, group.getDisplayName(), server, world);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("unset " + node + " " + server + " " + world)
|
||||
.build().submit(plugin, sender);
|
||||
@ -81,7 +81,7 @@ public class GroupUnSetPermission extends SubCommand<Group> {
|
||||
|
||||
} else {
|
||||
group.unsetPermission(node);
|
||||
Message.UNSETPERMISSION_SUCCESS.send(sender, node, group.getName());
|
||||
Message.UNSETPERMISSION_SUCCESS.send(sender, node, group.getDisplayName());
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("unset " + node)
|
||||
.build().submit(plugin, sender);
|
||||
@ -90,7 +90,7 @@ public class GroupUnSetPermission extends SubCommand<Group> {
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectLacksException e) {
|
||||
Message.DOES_NOT_HAVEPERMISSION.send(sender, group.getName());
|
||||
Message.DOES_NOT_HAVEPERMISSION.send(sender, group.getDisplayName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -62,14 +62,14 @@ public class GroupUnsetInherit extends SubCommand<Group> {
|
||||
|
||||
if (args.size() == 2) {
|
||||
group.unsetPermission("group." + groupName, server);
|
||||
Message.GROUP_UNSETINHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server);
|
||||
Message.GROUP_UNSETINHERIT_SERVER_SUCCESS.send(sender, group.getDisplayName(), groupName, server);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("unsetinherit " + groupName + " " + server)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
final String world = args.get(2).toLowerCase();
|
||||
group.unsetPermission("group." + groupName, server, world);
|
||||
Message.GROUP_UNSETINHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getName(), groupName, server, world);
|
||||
Message.GROUP_UNSETINHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), groupName, server, world);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("unsetinherit " + groupName + " " + server + " " + world)
|
||||
.build().submit(plugin, sender);
|
||||
@ -77,7 +77,7 @@ public class GroupUnsetInherit extends SubCommand<Group> {
|
||||
|
||||
} else {
|
||||
group.unsetPermission("group." + groupName);
|
||||
Message.GROUP_UNSETINHERIT_SUCCESS.send(sender, group.getName(), groupName);
|
||||
Message.GROUP_UNSETINHERIT_SUCCESS.send(sender, group.getDisplayName(), groupName);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("unsetinherit " + groupName)
|
||||
.build().submit(plugin, sender);
|
||||
@ -86,7 +86,7 @@ public class GroupUnsetInherit extends SubCommand<Group> {
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectLacksException e) {
|
||||
Message.GROUP_DOES_NOT_INHERIT.send(sender, group.getName(), groupName);
|
||||
Message.GROUP_DOES_NOT_INHERIT.send(sender, group.getDisplayName(), groupName);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -62,14 +62,14 @@ public class GroupUnsetTempInherit extends SubCommand<Group> {
|
||||
|
||||
if (args.size() == 2) {
|
||||
group.unsetPermission("group." + groupName, server, true);
|
||||
Message.GROUP_UNSET_TEMP_INHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server);
|
||||
Message.GROUP_UNSET_TEMP_INHERIT_SERVER_SUCCESS.send(sender, group.getDisplayName(), groupName, server);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("unsettempinherit " + groupName + " " + server)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
final String world = args.get(2).toLowerCase();
|
||||
group.unsetPermission("group." + groupName, server, world, true);
|
||||
Message.GROUP_UNSET_TEMP_INHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getName(), groupName, server, world);
|
||||
Message.GROUP_UNSET_TEMP_INHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getDisplayName(), groupName, server, world);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("unsettempinherit " + groupName + " " + server + " " + world)
|
||||
.build().submit(plugin, sender);
|
||||
@ -77,7 +77,7 @@ public class GroupUnsetTempInherit extends SubCommand<Group> {
|
||||
|
||||
} else {
|
||||
group.unsetPermission("group." + groupName, true);
|
||||
Message.GROUP_UNSET_TEMP_INHERIT_SUCCESS.send(sender, group.getName(), groupName);
|
||||
Message.GROUP_UNSET_TEMP_INHERIT_SUCCESS.send(sender, group.getDisplayName(), groupName);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("unsettempinherit " + groupName)
|
||||
.build().submit(plugin, sender);
|
||||
@ -86,7 +86,7 @@ public class GroupUnsetTempInherit extends SubCommand<Group> {
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectLacksException e) {
|
||||
Message.GROUP_DOES_NOT_TEMP_INHERIT.send(sender, group.getName(), groupName);
|
||||
Message.GROUP_DOES_NOT_TEMP_INHERIT.send(sender, group.getDisplayName(), groupName);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -67,14 +67,14 @@ public class GroupUnsetTempPermission extends SubCommand<Group> {
|
||||
|
||||
if (args.size() == 2) {
|
||||
group.unsetPermission(node, server);
|
||||
Message.UNSET_TEMP_PERMISSION_SERVER_SUCCESS.send(sender, node, group.getName(), server);
|
||||
Message.UNSET_TEMP_PERMISSION_SERVER_SUCCESS.send(sender, node, group.getDisplayName(), server);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("unsettemp " + node + " " + server)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
final String world = args.get(2).toLowerCase();
|
||||
group.unsetPermission(node, server, world);
|
||||
Message.UNSET_TEMP_PERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, group.getName(), server, world);
|
||||
Message.UNSET_TEMP_PERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, group.getDisplayName(), server, world);
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("unsettemp " + node + " " + server + " " + world)
|
||||
.build().submit(plugin, sender);
|
||||
@ -82,7 +82,7 @@ public class GroupUnsetTempPermission extends SubCommand<Group> {
|
||||
|
||||
} else {
|
||||
group.unsetPermission(node, true);
|
||||
Message.UNSET_TEMP_PERMISSION_SUCCESS.send(sender, node, group.getName());
|
||||
Message.UNSET_TEMP_PERMISSION_SUCCESS.send(sender, node, group.getDisplayName());
|
||||
LogEntry.build().actor(sender).acted(group)
|
||||
.action("unsettemp " + node)
|
||||
.build().submit(plugin, sender);
|
||||
@ -91,7 +91,7 @@ public class GroupUnsetTempPermission extends SubCommand<Group> {
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectLacksException e) {
|
||||
Message.DOES_NOT_HAVE_TEMP_PERMISSION.send(sender, group.getName());
|
||||
Message.DOES_NOT_HAVE_TEMP_PERMISSION.send(sender, group.getDisplayName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -48,14 +48,14 @@ public class InfoCommand extends SingleMainCommand {
|
||||
plugin.getDatastore().getName(),
|
||||
c.getServer(),
|
||||
c.getSyncTime(),
|
||||
formatBoolean(c.getIncludeGlobalPerms()),
|
||||
formatBoolean(c.getIncludeGlobalWorldPerms()),
|
||||
formatBoolean(c.getApplyGlobalGroups()),
|
||||
formatBoolean(c.getApplyGlobalWorldGroups()),
|
||||
formatBoolean(c.getOnlineMode()),
|
||||
formatBoolean(c.getApplyWildcards()),
|
||||
formatBoolean(c.getApplyRegex()),
|
||||
formatBoolean(c.getApplyShorthand())
|
||||
formatBoolean(c.isIncludingGlobalPerms()),
|
||||
formatBoolean(c.isIncludingGlobalWorldPerms()),
|
||||
formatBoolean(c.isApplyingGlobalGroups()),
|
||||
formatBoolean(c.isApplyingGlobalWorldGroups()),
|
||||
formatBoolean(c.isOnlineMode()),
|
||||
formatBoolean(c.isApplyingWildcards()),
|
||||
formatBoolean(c.isApplyingRegex()),
|
||||
formatBoolean(c.isApplyingShorthand())
|
||||
);
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
|
@ -73,14 +73,14 @@ public class UserAddGroup extends SubCommand<User> {
|
||||
|
||||
if (args.size() == 2) {
|
||||
user.addGroup(group, server);
|
||||
Message.USER_ADDGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server);
|
||||
Message.USER_ADDGROUP_SERVER_SUCCESS.send(sender, user.getName(), group.getDisplayName(), server);
|
||||
LogEntry.build().actor(sender).acted(user)
|
||||
.action("addgroup " + group.getName() + " " + server)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
final String world = args.get(2).toLowerCase();
|
||||
user.addGroup(group, server, world);
|
||||
Message.USER_ADDGROUP_SERVER_WORLD_SUCCESS.send(sender, user.getName(), groupName, server, world);
|
||||
Message.USER_ADDGROUP_SERVER_WORLD_SUCCESS.send(sender, user.getName(), group.getDisplayName(), server, world);
|
||||
LogEntry.build().actor(sender).acted(user)
|
||||
.action("addgroup " + group.getName() + " " + server + " " + world)
|
||||
.build().submit(plugin, sender);
|
||||
@ -88,7 +88,7 @@ public class UserAddGroup extends SubCommand<User> {
|
||||
|
||||
} else {
|
||||
user.addGroup(group);
|
||||
Message.USER_ADDGROUP_SUCCESS.send(sender, user.getName(), groupName);
|
||||
Message.USER_ADDGROUP_SUCCESS.send(sender, user.getName(), group.getDisplayName());
|
||||
LogEntry.build().actor(sender).acted(user)
|
||||
.action("addgroup " + group.getName())
|
||||
.build().submit(plugin, sender);
|
||||
@ -97,7 +97,7 @@ public class UserAddGroup extends SubCommand<User> {
|
||||
save(user, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectAlreadyHasException e) {
|
||||
Message.USER_ALREADY_MEMBER_OF.send(sender, user.getName(), group.getName());
|
||||
Message.USER_ALREADY_MEMBER_OF.send(sender, user.getName(), group.getDisplayName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class UserAddTempGroup extends SubCommand<User> {
|
||||
|
||||
if (args.size() == 3) {
|
||||
user.addGroup(group, server, duration);
|
||||
Message.USER_ADDTEMPGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server,
|
||||
Message.USER_ADDTEMPGROUP_SERVER_SUCCESS.send(sender, user.getName(), group.getDisplayName(), server,
|
||||
DateUtil.formatDateDiff(duration));
|
||||
LogEntry.build().actor(sender).acted(user)
|
||||
.action("addtempgroup " + group.getName() + " " + duration + " " + server)
|
||||
@ -100,7 +100,7 @@ public class UserAddTempGroup extends SubCommand<User> {
|
||||
} else {
|
||||
final String world = args.get(3).toLowerCase();
|
||||
user.addGroup(group, server, world, duration);
|
||||
Message.USER_ADDTEMPGROUP_SERVER_WORLD_SUCCESS.send(sender, user.getName(), groupName, server,
|
||||
Message.USER_ADDTEMPGROUP_SERVER_WORLD_SUCCESS.send(sender, user.getName(), group.getDisplayName(), server,
|
||||
world, DateUtil.formatDateDiff(duration));
|
||||
LogEntry.build().actor(sender).acted(user)
|
||||
.action("addtempgroup " + group.getName() + " " + duration + " " + server + " " + world)
|
||||
@ -109,7 +109,7 @@ public class UserAddTempGroup extends SubCommand<User> {
|
||||
|
||||
} else {
|
||||
user.addGroup(group, duration);
|
||||
Message.USER_ADDTEMPGROUP_SUCCESS.send(sender, user.getName(), groupName, DateUtil.formatDateDiff(duration));
|
||||
Message.USER_ADDTEMPGROUP_SUCCESS.send(sender, user.getName(), group.getDisplayName(), DateUtil.formatDateDiff(duration));
|
||||
LogEntry.build().actor(sender).acted(user)
|
||||
.action("addtempgroup " + group.getName() + " " + duration)
|
||||
.build().submit(plugin, sender);
|
||||
@ -118,7 +118,7 @@ public class UserAddTempGroup extends SubCommand<User> {
|
||||
save(user, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (ObjectAlreadyHasException e) {
|
||||
Message.USER_ALREADY_TEMP_MEMBER_OF.send(sender, user.getName(), group.getName());
|
||||
Message.USER_ALREADY_TEMP_MEMBER_OF.send(sender, user.getName(), group.getDisplayName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -103,9 +103,9 @@ public class UserDemote extends SubCommand<User> {
|
||||
} catch (ObjectAlreadyHasException ignored) {}
|
||||
user.setPrimaryGroup(previousGroup.getName());
|
||||
|
||||
Message.USER_DEMOTE_SUCCESS_PROMOTE.send(sender, track.getName(), old, previousGroup.getName());
|
||||
Message.USER_DEMOTE_SUCCESS_REMOVE.send(sender, user.getName(), old, previousGroup.getName(), previousGroup.getName());
|
||||
Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), previousGroup.getName(), old, true));
|
||||
Message.USER_DEMOTE_SUCCESS_PROMOTE.send(sender, track.getName(), old, previousGroup.getDisplayName());
|
||||
Message.USER_DEMOTE_SUCCESS_REMOVE.send(sender, user.getName(), old, previousGroup.getDisplayName(), previousGroup.getDisplayName());
|
||||
Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), previousGroup.getDisplayName(), old, true));
|
||||
LogEntry.build().actor(sender).acted(user)
|
||||
.action("demote " + track.getName() + "(from " + old + " to " + previousGroup.getName() + ")")
|
||||
.build().submit(plugin, sender);
|
||||
|
@ -41,7 +41,7 @@ public class UserInfo extends SubCommand<User> {
|
||||
user.getName(),
|
||||
user.getUuid(),
|
||||
plugin.getPlayerStatus(user.getUuid()),
|
||||
Util.listToCommaSep(user.getGroupNames()),
|
||||
Util.listToCommaSep(user.getGroupNames()), // TODO move this to own command
|
||||
user.getPrimaryGroup(),
|
||||
user.getPermanentNodes().size(),
|
||||
user.getTemporaryNodes().size(),
|
||||
|
@ -103,9 +103,9 @@ public class UserPromote extends SubCommand<User> {
|
||||
} catch (ObjectAlreadyHasException ignored) {}
|
||||
user.setPrimaryGroup(nextGroup.getName());
|
||||
|
||||
Message.USER_PROMOTE_SUCCESS_PROMOTE.send(sender, track.getName(), old, nextGroup.getName());
|
||||
Message.USER_PROMOTE_SUCCESS_REMOVE.send(sender, user.getName(), old, nextGroup.getName(), nextGroup.getName());
|
||||
Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), old, nextGroup.getName(), false));
|
||||
Message.USER_PROMOTE_SUCCESS_PROMOTE.send(sender, track.getName(), old, nextGroup.getDisplayName());
|
||||
Message.USER_PROMOTE_SUCCESS_REMOVE.send(sender, user.getName(), old, nextGroup.getDisplayName(), nextGroup.getDisplayName());
|
||||
Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), old, nextGroup.getDisplayName(), false));
|
||||
LogEntry.build().actor(sender).acted(user)
|
||||
.action("promote " + track.getName() + "(from " + old + " to " + nextGroup.getName() + ")")
|
||||
.build().submit(plugin, sender);
|
||||
|
@ -63,7 +63,7 @@ public class UserSetPrimaryGroup extends SubCommand<User> {
|
||||
}
|
||||
|
||||
user.setPrimaryGroup(group.getName());
|
||||
Message.USER_PRIMARYGROUP_SUCCESS.send(sender, user.getName(), group.getName());
|
||||
Message.USER_PRIMARYGROUP_SUCCESS.send(sender, user.getName(), group.getDisplayName());
|
||||
LogEntry.build().actor(sender).acted(user)
|
||||
.action("setprimarygroup " + group.getName())
|
||||
.build().submit(plugin, sender);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -22,156 +22,68 @@
|
||||
|
||||
package me.lucko.luckperms.core;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.constants.Patterns;
|
||||
import me.lucko.luckperms.storage.DatastoreConfiguration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class LPConfiguration<T extends LuckPermsPlugin> {
|
||||
public interface LPConfiguration {
|
||||
|
||||
@Getter(AccessLevel.PROTECTED)
|
||||
private final T plugin;
|
||||
String getServer();
|
||||
|
||||
private final String defaultServerName;
|
||||
private final boolean defaultIncludeGlobal;
|
||||
private final String defaultStorage;
|
||||
|
||||
public LPConfiguration(T plugin, String defaultServerName, boolean defaultIncludeGlobal, String defaultStorage) {
|
||||
this.plugin = plugin;
|
||||
this.defaultServerName = defaultServerName;
|
||||
this.defaultIncludeGlobal = defaultIncludeGlobal;
|
||||
this.defaultStorage = defaultStorage;
|
||||
init();
|
||||
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(getServer()).find()) {
|
||||
plugin.getLog().severe("Server name defined in config.yml contains invalid characters. Server names can " +
|
||||
"only contain alphanumeric characters.\nDefined server name '" + getServer() + "' will be replaced with '" +
|
||||
defaultServerName + "' (the default)");
|
||||
set("server", defaultServerName);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void init();
|
||||
protected abstract void set(String path, Object value);
|
||||
protected abstract String getString(String path, String def);
|
||||
protected abstract int getInt(String path, int def);
|
||||
protected abstract boolean getBoolean(String path, boolean def);
|
||||
|
||||
public String getServer() {
|
||||
return getString("server", defaultServerName);
|
||||
}
|
||||
|
||||
public int getSyncTime() {
|
||||
return getInt("data.sync-minutes", 3);
|
||||
}
|
||||
int getSyncTime();
|
||||
|
||||
/**
|
||||
* As of 2.6, this value is a constant
|
||||
* @return the default group node
|
||||
*/
|
||||
@SuppressWarnings("SameReturnValue")
|
||||
public String getDefaultGroupNode() {
|
||||
return "group.default";
|
||||
}
|
||||
String getDefaultGroupNode();
|
||||
|
||||
/**
|
||||
* As of 2.6, this value is a constant
|
||||
* @return the name of the default group
|
||||
*/
|
||||
@SuppressWarnings("SameReturnValue")
|
||||
public String getDefaultGroupName() {
|
||||
return "default";
|
||||
}
|
||||
String getDefaultGroupName();
|
||||
|
||||
public boolean getIncludeGlobalPerms() {
|
||||
return getBoolean("include-global", defaultIncludeGlobal);
|
||||
}
|
||||
boolean isIncludingGlobalPerms();
|
||||
|
||||
public boolean getIncludeGlobalWorldPerms() {
|
||||
return getBoolean("include-global-world", true);
|
||||
}
|
||||
boolean isIncludingGlobalWorldPerms();
|
||||
|
||||
public boolean getApplyGlobalGroups() {
|
||||
return getBoolean("apply-global-groups", true);
|
||||
}
|
||||
boolean isApplyingGlobalGroups();
|
||||
|
||||
public boolean getApplyGlobalWorldGroups() {
|
||||
return getBoolean("apply-global-world-groups", true);
|
||||
}
|
||||
boolean isApplyingGlobalWorldGroups();
|
||||
|
||||
public boolean getOnlineMode() {
|
||||
return getBoolean("online-mode", true);
|
||||
}
|
||||
boolean isOnlineMode();
|
||||
|
||||
public boolean getApplyWildcards() {
|
||||
return getBoolean("apply-wildcards", true);
|
||||
}
|
||||
boolean isApplyingWildcards();
|
||||
|
||||
public boolean getApplyRegex() {
|
||||
return getBoolean("apply-regex", true);
|
||||
}
|
||||
boolean isApplyingRegex();
|
||||
|
||||
public boolean getApplyShorthand() {
|
||||
return getBoolean("apply-shorthand", true);
|
||||
}
|
||||
boolean isApplyingShorthand();
|
||||
|
||||
public boolean getLogNotify() {
|
||||
return getBoolean("log-notify", true);
|
||||
}
|
||||
boolean isLogNotify();
|
||||
|
||||
public boolean getDebugPermissionChecks() {
|
||||
return getBoolean("debug-permission-checks", false);
|
||||
}
|
||||
boolean isDebugPermissionChecks();
|
||||
|
||||
public boolean getEnableOps() {
|
||||
return !getAutoOp() && getBoolean("enable-ops", true);
|
||||
}
|
||||
boolean isOpsEnabled();
|
||||
|
||||
public boolean getCommandsAllowOp() {
|
||||
return getBoolean("commands-allow-op", true);
|
||||
}
|
||||
boolean isCommandsAllowOp();
|
||||
|
||||
public boolean getAutoOp() {
|
||||
return getBoolean("auto-op", false);
|
||||
}
|
||||
boolean isAutoOp();
|
||||
|
||||
public String getVaultServer() {
|
||||
return getString("vault-server", "global");
|
||||
}
|
||||
String getVaultServer();
|
||||
|
||||
public boolean getVaultIncludeGlobal() {
|
||||
return getBoolean("vault-include-global", true);
|
||||
}
|
||||
boolean isVaultIncludingGlobal();
|
||||
|
||||
public DatastoreConfiguration getDatabaseValues() {
|
||||
return new DatastoreConfiguration(
|
||||
getString("data.address", null),
|
||||
getString("data.database", null),
|
||||
getString("data.username", null),
|
||||
getString("data.password", null)
|
||||
);
|
||||
}
|
||||
Map<String, String> getWorldRewrites();
|
||||
|
||||
public String getStorageMethod() {
|
||||
return getString("storage-method", defaultStorage);
|
||||
}
|
||||
Map<String, String> getGroupNameRewrites();
|
||||
|
||||
public boolean getSplitStorage() {
|
||||
return getBoolean("split-storage.enabled", false);
|
||||
}
|
||||
DatastoreConfiguration getDatabaseValues();
|
||||
|
||||
public Map<String, String> getSplitStorageOptions() {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("user", getString("split-storage.methods.user", defaultStorage));
|
||||
map.put("group", getString("split-storage.methods.group", defaultStorage));
|
||||
map.put("track", getString("split-storage.methods.track", defaultStorage));
|
||||
map.put("uuid", getString("split-storage.methods.uuid", defaultStorage));
|
||||
map.put("log", getString("split-storage.methods.log", defaultStorage));
|
||||
String getStorageMethod();
|
||||
|
||||
boolean isSplitStorage();
|
||||
|
||||
Map<String, String> getSplitStorageOptions();
|
||||
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -161,12 +161,12 @@ public abstract class PermissionHolder {
|
||||
while (iterator.hasNext()) {
|
||||
Node node = iterator.next();
|
||||
|
||||
if (!node.shouldApplyOnServer(context.getServer(), context.isApplyGlobalGroups(), plugin.getConfiguration().getApplyRegex())) {
|
||||
if (!node.shouldApplyOnServer(context.getServer(), context.isApplyGlobalGroups(), plugin.getConfiguration().isApplyingRegex())) {
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!node.shouldApplyOnWorld(context.getWorld(), context.isApplyGlobalWorldGroups(), plugin.getConfiguration().getApplyRegex())) {
|
||||
if (!node.shouldApplyOnWorld(context.getWorld(), context.isApplyGlobalWorldGroups(), plugin.getConfiguration().isApplyingRegex())) {
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
@ -214,11 +214,11 @@ public abstract class PermissionHolder {
|
||||
|
||||
all:
|
||||
for (Node node : allNodes) {
|
||||
if (!node.shouldApplyOnServer(context.getServer(), context.isIncludeGlobal(), plugin.getConfiguration().getApplyRegex())) {
|
||||
if (!node.shouldApplyOnServer(context.getServer(), context.isIncludeGlobal(), plugin.getConfiguration().isApplyingRegex())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!node.shouldApplyOnWorld(context.getWorld(), context.isIncludeGlobalWorld(), plugin.getConfiguration().getApplyRegex())) {
|
||||
if (!node.shouldApplyOnWorld(context.getWorld(), context.isIncludeGlobalWorld(), plugin.getConfiguration().isApplyingRegex())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ public abstract class PermissionHolder {
|
||||
for (Node node : getAllNodesFiltered(context)) {
|
||||
if (possibleNodes != null && !possibleNodes.isEmpty()) {
|
||||
if (node.getPermission().equals("*") || node.getPermission().equals("'*'")) {
|
||||
if (plugin.getConfiguration().getApplyWildcards()) {
|
||||
if (plugin.getConfiguration().isApplyingWildcards()) {
|
||||
possibleNodes.forEach(n -> perms.put(n, true));
|
||||
}
|
||||
}
|
||||
@ -259,14 +259,14 @@ public abstract class PermissionHolder {
|
||||
|
||||
perms.put(node.getPermission(), node.getValue());
|
||||
|
||||
if (plugin.getConfiguration().getApplyShorthand()) {
|
||||
if (plugin.getConfiguration().isApplyingShorthand()) {
|
||||
node.resolveShorthand().stream()
|
||||
.filter(s -> !perms.containsKey(s))
|
||||
.forEach(s -> perms.put(s, node.getValue()));
|
||||
}
|
||||
|
||||
if (possibleNodes != null && !possibleNodes.isEmpty()) {
|
||||
if (plugin.getConfiguration().getApplyWildcards()) {
|
||||
if (plugin.getConfiguration().isApplyingWildcards()) {
|
||||
node.resolveWildcard(possibleNodes).stream()
|
||||
.filter(s -> !perms.containsKey(s))
|
||||
.forEach(s -> perms.put(s, node.getValue()));
|
||||
@ -552,12 +552,12 @@ public abstract class PermissionHolder {
|
||||
*/
|
||||
@Deprecated
|
||||
public Map<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
|
||||
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")
|
||||
|
@ -50,7 +50,7 @@ public class LogEntry extends me.lucko.luckperms.api.LogEntry {
|
||||
plugin.getDatastore().logAction(this);
|
||||
|
||||
LogNotifyEvent event = new LogNotifyEvent(this);
|
||||
event.setCancelled(!plugin.getConfiguration().getLogNotify());
|
||||
event.setCancelled(!plugin.getConfiguration().isLogNotify());
|
||||
plugin.getApiProvider().fireEvent(event);
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
|
@ -58,6 +58,15 @@ public class Group extends PermissionHolder implements Identifiable<String> {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getRawDisplayName() {
|
||||
return getPlugin().getConfiguration().getGroupNameRewrites().getOrDefault(name, name);
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
String dn = getRawDisplayName();
|
||||
return dn.equals(name) ? name : name + " (" + dn + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* check to see if a group inherits a group
|
||||
* @param group The group to check membership of
|
||||
|
@ -37,16 +37,14 @@ import java.util.Set;
|
||||
public class StorageFactory {
|
||||
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) {
|
||||
Datastore datastore;
|
||||
|
||||
plugin.getLog().info("Detecting storage method...");
|
||||
if (plugin.getConfiguration().getSplitStorage()) {
|
||||
if (plugin.getConfiguration().isSplitStorage()) {
|
||||
plugin.getLog().info("Using split storage.");
|
||||
|
||||
// java sucks
|
||||
Map<String, String> types = (Map<String, String>) plugin.getConfiguration().getSplitStorageOptions();
|
||||
Map<String, String> types = plugin.getConfiguration().getSplitStorageOptions();
|
||||
|
||||
types.entrySet().stream()
|
||||
.filter(e -> !TYPES.contains(e.getValue().toLowerCase()))
|
||||
|
@ -37,11 +37,11 @@ public class Contexts {
|
||||
configuration.getServer(),
|
||||
null,
|
||||
Collections.emptyMap(),
|
||||
configuration.getIncludeGlobalPerms(),
|
||||
configuration.getIncludeGlobalWorldPerms(),
|
||||
configuration.isIncludingGlobalPerms(),
|
||||
configuration.isIncludingGlobalWorldPerms(),
|
||||
true,
|
||||
configuration.getApplyGlobalGroups(),
|
||||
configuration.getApplyGlobalWorldGroups()
|
||||
configuration.isApplyingGlobalGroups(),
|
||||
configuration.isApplyingGlobalWorldGroups()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class LPSpongePlugin implements LuckPermsPlugin {
|
||||
datastore = StorageFactory.getDatastore(this, "h2");
|
||||
|
||||
getLog().info("Loading internal permission managers...");
|
||||
uuidCache = new UuidCache(getConfiguration().getOnlineMode());
|
||||
uuidCache = new UuidCache(getConfiguration().isOnlineMode());
|
||||
userManager = new SpongeUserManager(this);
|
||||
groupManager = new GroupManager(this);
|
||||
trackManager = new TrackManager();
|
||||
|
@ -23,7 +23,7 @@
|
||||
package me.lucko.luckperms;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import me.lucko.luckperms.core.LPConfiguration;
|
||||
import me.lucko.luckperms.core.AbstractConfiguration;
|
||||
import ninja.leaping.configurate.ConfigurationNode;
|
||||
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
|
||||
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
|
||||
@ -34,8 +34,10 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class SpongeConfig extends LPConfiguration<LPSpongePlugin> {
|
||||
class SpongeConfig extends AbstractConfiguration<LPSpongePlugin> {
|
||||
private ConfigurationNode root;
|
||||
|
||||
SpongeConfig(LPSpongePlugin plugin) {
|
||||
@ -80,11 +82,6 @@ class SpongeConfig extends LPConfiguration<LPSpongePlugin> {
|
||||
return node;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void set(String path, Object value) {
|
||||
getNode(path).setValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getString(String path, String def) {
|
||||
return getNode(path).getString(def);
|
||||
@ -99,4 +96,10 @@ class SpongeConfig extends LPConfiguration<LPSpongePlugin> {
|
||||
protected boolean getBoolean(String path, boolean 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));
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ public class LuckPermsSubject implements Subject {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!n.shouldApplyOnServer(service.getPlugin().getConfiguration().getVaultServer(), service.getPlugin().getConfiguration().getVaultIncludeGlobal(), false)) {
|
||||
if (!n.shouldApplyOnServer(service.getPlugin().getConfiguration().getVaultServer(), service.getPlugin().getConfiguration().isVaultIncludingGlobal(), false)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -56,16 +56,16 @@ public class LuckPermsUserSubject extends LuckPermsSubject {
|
||||
|
||||
List<PermissionProcessor> processors = new ArrayList<>(5);
|
||||
processors.add(new PermissionCalculator.MapProcessor(permissionCache));
|
||||
if (service.getPlugin().getConfiguration().getApplyWildcards()) {
|
||||
if (service.getPlugin().getConfiguration().isApplyingWildcards()) {
|
||||
processors.add(new SpongeWildcardProcessor(permissionCache));
|
||||
processors.add(new PermissionCalculator.WildcardProcessor(permissionCache));
|
||||
}
|
||||
if (service.getPlugin().getConfiguration().getApplyRegex()) {
|
||||
if (service.getPlugin().getConfiguration().isApplyingRegex()) {
|
||||
processors.add(new PermissionCalculator.RegexProcessor(permissionCache));
|
||||
}
|
||||
processors.add(new SpongeDefaultsProcessor(service));
|
||||
|
||||
calculator = new PermissionCalculator(service.getPlugin(), user.getName(), service.getPlugin().getConfiguration().getDebugPermissionChecks(), processors);
|
||||
calculator = new PermissionCalculator(service.getPlugin(), user.getName(), service.getPlugin().getConfiguration().isDebugPermissionChecks(), processors);
|
||||
}
|
||||
|
||||
public void invalidateCache() {
|
||||
|
@ -59,11 +59,11 @@ class SpongeUser extends User {
|
||||
plugin.getConfiguration().getServer(),
|
||||
null, // TODO per world perms
|
||||
null,
|
||||
plugin.getConfiguration().getIncludeGlobalPerms(),
|
||||
plugin.getConfiguration().getIncludeGlobalWorldPerms(),
|
||||
plugin.getConfiguration().isIncludingGlobalPerms(),
|
||||
plugin.getConfiguration().isIncludingGlobalWorldPerms(),
|
||||
true,
|
||||
plugin.getConfiguration().getApplyGlobalGroups(),
|
||||
plugin.getConfiguration().getApplyGlobalWorldGroups()
|
||||
plugin.getConfiguration().isApplyingGlobalGroups(),
|
||||
plugin.getConfiguration().isApplyingGlobalWorldGroups()
|
||||
),
|
||||
Collections.emptyList()
|
||||
);
|
||||
|
@ -55,6 +55,18 @@ debug-permission-checks=false
|
||||
# If the plugin should send log notifications to users whenever permissions are modified.
|
||||
log-notify=true
|
||||
|
||||
# Mirrors world names. Whenever LuckPerms checks what world a user is in, if the world name is in this list, the value assigned
|
||||
# will be sent forward for permission calculation instead.
|
||||
world-rewrite: {
|
||||
#world_nether="world"
|
||||
#world_the_end="world"
|
||||
}
|
||||
|
||||
# Rewrites group names. The underlying name of the group does not change, just the output in commands / placeholders / Vault.
|
||||
group-name-rewrite: {
|
||||
#default: "Member"
|
||||
}
|
||||
|
||||
# Which storage method the plugin should use.
|
||||
# Currently supported: mysql, sqlite, h2, json, yaml, mongodb
|
||||
# Fill out connection info below if you're using MySQL or MongoDB
|
||||
|
@ -22,9 +22,11 @@
|
||||
|
||||
package me.lucko.luckperms.internal;
|
||||
|
||||
import me.lucko.luckperms.core.LPConfiguration;
|
||||
import me.lucko.luckperms.core.AbstractConfiguration;
|
||||
|
||||
public class StandaloneConfiguration extends LPConfiguration<StandaloneBase> {
|
||||
import java.util.Map;
|
||||
|
||||
public class StandaloneConfiguration extends AbstractConfiguration<StandaloneBase> {
|
||||
public StandaloneConfiguration(StandaloneBase plugin) {
|
||||
super(plugin, "global", true, "null");
|
||||
}
|
||||
@ -33,11 +35,6 @@ public class StandaloneConfiguration extends LPConfiguration<StandaloneBase> {
|
||||
protected void init() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void set(String path, Object value) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getString(String path, String def) {
|
||||
return def;
|
||||
@ -52,4 +49,9 @@ public class StandaloneConfiguration extends LPConfiguration<StandaloneBase> {
|
||||
protected boolean getBoolean(String path, boolean def) {
|
||||
return def;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getMap(String path, Map<String, String> def) {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user