Form more descriptive console & import usernames

This commit is contained in:
Luck 2017-10-23 23:37:55 +01:00
parent c573c755d2
commit 54695b8046
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
7 changed files with 13 additions and 8 deletions

View File

@ -204,7 +204,7 @@ public interface LPConfiguration {
* <p>This method is nested under {@link Unsafe} because the keys
* and return types may change between versions without warning.</p>
*
* @param key the key, as defined as a parameter name in
* @param key the key, as defined as a field name in
* the "ConfigKeys" class.
* @return the corresponding object, if one is present
* @throws IllegalArgumentException if the key isn't known

View File

@ -28,6 +28,7 @@ package me.lucko.luckperms.bukkit;
import me.lucko.luckperms.api.Tristate;
import me.lucko.luckperms.bukkit.compat.MessageHandler;
import me.lucko.luckperms.common.commands.sender.SenderFactory;
import me.lucko.luckperms.common.config.ConfigKeys;
import me.lucko.luckperms.common.constants.Constants;
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
@ -52,7 +53,7 @@ public class BukkitSenderFactory extends SenderFactory<CommandSender> {
if (sender instanceof Player) {
return sender.getName();
}
return Constants.CONSOLE_NAME;
return Constants.CONSOLE_NAME.apply(getPlugin().getConfiguration().get(ConfigKeys.SERVER));
}
@Override

View File

@ -28,6 +28,7 @@ package me.lucko.luckperms.bungee;
import me.lucko.luckperms.api.Tristate;
import me.lucko.luckperms.bungee.event.TristateCheckEvent;
import me.lucko.luckperms.common.commands.sender.SenderFactory;
import me.lucko.luckperms.common.config.ConfigKeys;
import me.lucko.luckperms.common.constants.Constants;
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
import me.lucko.luckperms.common.utils.TextUtils;
@ -50,7 +51,7 @@ public class BungeeSenderFactory extends SenderFactory<CommandSender> {
if (sender instanceof ProxiedPlayer) {
return sender.getName();
}
return Constants.CONSOLE_NAME;
return Constants.CONSOLE_NAME.apply(getPlugin().getConfiguration().get(ConfigKeys.SERVER));
}
@Override

View File

@ -29,6 +29,7 @@ import lombok.AllArgsConstructor;
import me.lucko.luckperms.api.Tristate;
import me.lucko.luckperms.common.commands.sender.Sender;
import me.lucko.luckperms.common.config.ConfigKeys;
import me.lucko.luckperms.common.constants.CommandPermission;
import me.lucko.luckperms.common.constants.Constants;
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
@ -51,7 +52,7 @@ public abstract class ImporterSender implements Sender {
@Override
public String getName() {
return Constants.IMPORT_NAME;
return Constants.IMPORT_NAME.apply(plugin.getConfiguration().get(ConfigKeys.SERVER));
}
@Override

View File

@ -28,6 +28,7 @@ package me.lucko.luckperms.common.constants;
import lombok.experimental.UtilityClass;
import java.util.UUID;
import java.util.function.Function;
/**
* Random constants used throughout the plugin implementation.
@ -36,10 +37,10 @@ import java.util.UUID;
public class Constants {
public static final UUID CONSOLE_UUID = UUID.fromString("00000000-0000-0000-0000-000000000000");
public static final String CONSOLE_NAME = "Console";
public static final Function<String, String> CONSOLE_NAME = s -> s == null || s.equalsIgnoreCase("global") ? "Console" : "console@" + s;
public static final UUID IMPORT_UUID = UUID.fromString("11111111-1111-1111-1111-111111111111");
public static final String IMPORT_NAME = "Import";
public static final Function<String, String> IMPORT_NAME = s -> s == null || s.equalsIgnoreCase("global") ? "Import" : "import@" + s;
public static final char COLOR_CHAR = '\u00A7';
public static final char FORMAT_CHAR = '&';

View File

@ -454,7 +454,7 @@ public class LPSpongePlugin implements LuckPermsPlugin {
@Override
public String getName() {
return Constants.CONSOLE_NAME;
return Constants.CONSOLE_NAME.apply(getConfiguration().get(ConfigKeys.SERVER));
}
@Override

View File

@ -27,6 +27,7 @@ package me.lucko.luckperms.sponge;
import me.lucko.luckperms.api.Tristate;
import me.lucko.luckperms.common.commands.sender.SenderFactory;
import me.lucko.luckperms.common.config.ConfigKeys;
import me.lucko.luckperms.common.constants.Constants;
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
import me.lucko.luckperms.common.utils.TextUtils;
@ -51,7 +52,7 @@ public class SpongeSenderFactory extends SenderFactory<CommandSource> {
if (source instanceof Player) {
return source.getName();
}
return Constants.CONSOLE_NAME;
return Constants.CONSOLE_NAME.apply(getPlugin().getConfiguration().get(ConfigKeys.SERVER));
}
@Override