Add Sender#getNameWithLocation
This commit is contained in:
parent
0f10bb0bc9
commit
b7541c43c8
@ -54,7 +54,7 @@ public class BukkitSenderFactory extends SenderFactory<CommandSender> {
|
|||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
return sender.getName();
|
return sender.getName();
|
||||||
}
|
}
|
||||||
return getConsoleName();
|
return Constants.CONSOLE_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,7 +50,7 @@ public class BungeeSenderFactory extends SenderFactory<CommandSender> {
|
|||||||
if (sender instanceof ProxiedPlayer) {
|
if (sender instanceof ProxiedPlayer) {
|
||||||
return sender.getName();
|
return sender.getName();
|
||||||
}
|
}
|
||||||
return getConsoleName();
|
return Constants.CONSOLE_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -108,7 +108,7 @@ public class ExtendedLogEntry extends LogEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ExtendedLogEntryBuilder actor(Sender actor) {
|
public ExtendedLogEntryBuilder actor(Sender actor) {
|
||||||
super.actorName(actor.getName());
|
super.actorName(actor.getNameWithLocation());
|
||||||
super.actor(actor.getUuid());
|
super.actor(actor.getUuid());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ public class Exporter implements Runnable {
|
|||||||
log.log("Starting.");
|
log.log("Starting.");
|
||||||
|
|
||||||
write(writer, "# LuckPerms Export File");
|
write(writer, "# LuckPerms Export File");
|
||||||
write(writer, "# Generated by " + executor.getName() + " at " + DATE_FORMAT.format(new Date(System.currentTimeMillis())));
|
write(writer, "# Generated by " + executor.getNameWithLocation() + " at " + DATE_FORMAT.format(new Date(System.currentTimeMillis())));
|
||||||
write(writer, "");
|
write(writer, "");
|
||||||
|
|
||||||
// Export Groups
|
// Export Groups
|
||||||
|
@ -25,12 +25,10 @@
|
|||||||
|
|
||||||
package me.lucko.luckperms.common.backup;
|
package me.lucko.luckperms.common.backup;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.Getter;
|
||||||
|
|
||||||
import me.lucko.luckperms.api.Tristate;
|
import me.lucko.luckperms.api.Tristate;
|
||||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
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.constants.Constants;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.utils.TextUtils;
|
import me.lucko.luckperms.common.utils.TextUtils;
|
||||||
@ -39,30 +37,28 @@ import net.kyori.text.Component;
|
|||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@AllArgsConstructor
|
@Getter
|
||||||
public abstract class ImporterSender implements Sender {
|
public abstract class ImporterSender implements Sender {
|
||||||
private final LuckPermsPlugin plugin;
|
private final LuckPermsPlugin platform;
|
||||||
|
|
||||||
|
private final UUID uuid;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public ImporterSender(LuckPermsPlugin plugin, UUID uuid, String name) {
|
||||||
|
this.platform = plugin;
|
||||||
|
this.uuid = uuid;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImporterSender(LuckPermsPlugin plugin) {
|
||||||
|
this(plugin, Constants.IMPORT_UUID, Constants.IMPORT_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract void consumeMessage(String s);
|
protected abstract void consumeMessage(String s);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LuckPermsPlugin getPlatform() {
|
public void sendMessage(String message) {
|
||||||
return plugin;
|
consumeMessage(message);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return Constants.IMPORT_NAME.apply(plugin.getConfiguration().get(ConfigKeys.SERVER));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID getUuid() {
|
|
||||||
return Constants.IMPORT_UUID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendMessage(String s) {
|
|
||||||
consumeMessage(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@ -81,23 +77,4 @@ public abstract class ImporterSender implements Sender {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPermission(CommandPermission permission) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isConsole() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isImport() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValid() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ public class HolderEditor<T extends PermissionHolder> extends SubCommand<T> {
|
|||||||
Set<NodeModel> nodes = holder.getEnduringNodes().values().stream().map(NodeModel::fromNode).collect(Collectors.toCollection(LinkedHashSet::new));
|
Set<NodeModel> nodes = holder.getEnduringNodes().values().stream().map(NodeModel::fromNode).collect(Collectors.toCollection(LinkedHashSet::new));
|
||||||
data.addProperty("who", id(holder));
|
data.addProperty("who", id(holder));
|
||||||
data.addProperty("cmdAlias", label);
|
data.addProperty("cmdAlias", label);
|
||||||
data.addProperty("uploadedBy", sender.getName());
|
data.addProperty("uploadedBy", sender.getNameWithLocation());
|
||||||
data.addProperty("time", System.currentTimeMillis());
|
data.addProperty("time", System.currentTimeMillis());
|
||||||
data.add("nodes", serializePermissions(nodes));
|
data.add("nodes", serializePermissions(nodes));
|
||||||
|
|
||||||
|
@ -25,20 +25,20 @@
|
|||||||
|
|
||||||
package me.lucko.luckperms.common.commands.sender;
|
package me.lucko.luckperms.common.commands.sender;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
|
|
||||||
import me.lucko.luckperms.api.Tristate;
|
import me.lucko.luckperms.api.Tristate;
|
||||||
import me.lucko.luckperms.common.constants.CommandPermission;
|
|
||||||
import me.lucko.luckperms.common.constants.Constants;
|
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.utils.TextUtils;
|
import me.lucko.luckperms.common.utils.TextUtils;
|
||||||
|
|
||||||
import net.kyori.text.Component;
|
import net.kyori.text.Component;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,31 +52,36 @@ public final class AbstractSender<T> implements Sender {
|
|||||||
private static final Splitter NEW_LINE_SPLITTER = Splitter.on("\n");
|
private static final Splitter NEW_LINE_SPLITTER = Splitter.on("\n");
|
||||||
|
|
||||||
private final LuckPermsPlugin platform;
|
private final LuckPermsPlugin platform;
|
||||||
|
|
||||||
|
@Getter(AccessLevel.NONE)
|
||||||
private final SenderFactory<T> factory;
|
private final SenderFactory<T> factory;
|
||||||
private final WeakReference<T> ref;
|
|
||||||
private final String name;
|
@Getter(AccessLevel.NONE)
|
||||||
|
private final WeakReference<T> reference;
|
||||||
|
|
||||||
private final UUID uuid;
|
private final UUID uuid;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
AbstractSender(LuckPermsPlugin platform, SenderFactory<T> factory, T t) {
|
AbstractSender(LuckPermsPlugin platform, SenderFactory<T> factory, T t) {
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
this.ref = new WeakReference<>(t);
|
this.reference = new WeakReference<>(t);
|
||||||
this.name = factory.getName(t);
|
|
||||||
this.uuid = factory.getUuid(t);
|
this.uuid = factory.getUuid(t);
|
||||||
|
this.name = factory.getName(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(String s) {
|
public void sendMessage(String message) {
|
||||||
final T t = ref.get();
|
final T t = reference.get();
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
|
|
||||||
if (!isConsole()) {
|
if (!isConsole()) {
|
||||||
factory.sendMessage(t, s);
|
factory.sendMessage(t, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it is console, split up the lines and send individually.
|
// if it is console, split up the lines and send individually.
|
||||||
for (String line : NEW_LINE_SPLITTER.split(s)) {
|
for (String line : NEW_LINE_SPLITTER.split(message)) {
|
||||||
factory.sendMessage(t, line);
|
factory.sendMessage(t, line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,7 +95,7 @@ public final class AbstractSender<T> implements Sender {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final T t = ref.get();
|
final T t = reference.get();
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
factory.sendMessage(t, message);
|
factory.sendMessage(t, message);
|
||||||
}
|
}
|
||||||
@ -98,49 +103,33 @@ public final class AbstractSender<T> implements Sender {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tristate getPermissionValue(String permission) {
|
public Tristate getPermissionValue(String permission) {
|
||||||
if (isConsole()) return Tristate.TRUE;
|
T t = reference.get();
|
||||||
|
|
||||||
T t = ref.get();
|
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
return factory.getPermissionValue(t, permission);
|
return factory.getPermissionValue(t, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Tristate.UNDEFINED;
|
return isConsole() ? Tristate.TRUE : Tristate.UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(String permission) {
|
public boolean hasPermission(String permission) {
|
||||||
if (isConsole()) return true;
|
T t = reference.get();
|
||||||
|
|
||||||
T t = ref.get();
|
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
if (factory.hasPermission(t, permission)) {
|
if (factory.hasPermission(t, permission)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return isConsole();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPermission(CommandPermission permission) {
|
|
||||||
return hasPermission(permission.getPermission());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isConsole() {
|
|
||||||
return this.uuid.equals(Constants.CONSOLE_UUID) || this.uuid.equals(Constants.IMPORT_UUID);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isImport() {
|
|
||||||
// the importer uses it's own instance of Sender
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return ref.get() != null;
|
return reference.get() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<Object> getHandle() {
|
||||||
|
return Optional.ofNullable(reference.get());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,12 +26,15 @@
|
|||||||
package me.lucko.luckperms.common.commands.sender;
|
package me.lucko.luckperms.common.commands.sender;
|
||||||
|
|
||||||
import me.lucko.luckperms.api.Tristate;
|
import me.lucko.luckperms.api.Tristate;
|
||||||
|
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||||
|
import me.lucko.luckperms.common.config.LuckPermsConfiguration;
|
||||||
import me.lucko.luckperms.common.constants.CommandPermission;
|
import me.lucko.luckperms.common.constants.CommandPermission;
|
||||||
import me.lucko.luckperms.common.constants.Constants;
|
import me.lucko.luckperms.common.constants.Constants;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
|
|
||||||
import net.kyori.text.Component;
|
import net.kyori.text.Component;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,6 +56,37 @@ public interface Sender {
|
|||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a string representing the senders username, and their current location
|
||||||
|
* within the network.
|
||||||
|
*
|
||||||
|
* @return a friendly identifier for the sender
|
||||||
|
*/
|
||||||
|
default String getNameWithLocation() {
|
||||||
|
String name = getName();
|
||||||
|
|
||||||
|
LuckPermsConfiguration config = getPlatform().getConfiguration();
|
||||||
|
|
||||||
|
if (config == null) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
String location = config.get(ConfigKeys.SERVER);
|
||||||
|
if (location == null || location.equalsIgnoreCase("global")) {
|
||||||
|
location = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!location.isEmpty()) {
|
||||||
|
location = "@" + location;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isConsole() && !location.isEmpty()) {
|
||||||
|
name = name.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
return name + location;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the sender's unique id. See {@link Constants#CONSOLE_UUID} for the console's UUID representation.
|
* Gets the sender's unique id. See {@link Constants#CONSOLE_UUID} for the console's UUID representation.
|
||||||
*
|
*
|
||||||
@ -63,9 +97,9 @@ public interface Sender {
|
|||||||
/**
|
/**
|
||||||
* Send a message back to the Sender
|
* Send a message back to the Sender
|
||||||
*
|
*
|
||||||
* @param s the message to send. Supports '§' for message formatting.
|
* @param message the message to send. Supports '§' for message formatting.
|
||||||
*/
|
*/
|
||||||
void sendMessage(String s);
|
void sendMessage(String message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a json message to the Sender.
|
* Send a json message to the Sender.
|
||||||
@ -96,27 +130,45 @@ public interface Sender {
|
|||||||
* @param permission the permission to check for
|
* @param permission the permission to check for
|
||||||
* @return true if the sender has the permission
|
* @return true if the sender has the permission
|
||||||
*/
|
*/
|
||||||
boolean hasPermission(CommandPermission permission);
|
default boolean hasPermission(CommandPermission permission) {
|
||||||
|
return hasPermission(permission.getPermission());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets whether this sender is the console
|
* Gets whether this sender is the console
|
||||||
*
|
*
|
||||||
* @return if the sender is the console
|
* @return if the sender is the console
|
||||||
*/
|
*/
|
||||||
boolean isConsole();
|
default boolean isConsole() {
|
||||||
|
return Constants.CONSOLE_UUID.equals(getUuid()) || Constants.IMPORT_UUID.equals(getUuid());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets whether this sender is an import process
|
* Gets whether this sender is an import process
|
||||||
*
|
*
|
||||||
* @return if the sender is an import process
|
* @return if the sender is an import process
|
||||||
*/
|
*/
|
||||||
boolean isImport();
|
default boolean isImport() {
|
||||||
|
return Constants.IMPORT_UUID.equals(getUuid());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets whether this sender is still valid & receiving messages.
|
* Gets whether this sender is still valid & receiving messages.
|
||||||
*
|
*
|
||||||
* @return if this sender is valid
|
* @return if this sender is valid
|
||||||
*/
|
*/
|
||||||
boolean isValid();
|
default boolean isValid() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the handle object for this sender. (In most cases, the real
|
||||||
|
* CommandSender/CommandSource object from the platform)
|
||||||
|
*
|
||||||
|
* @return the handle
|
||||||
|
*/
|
||||||
|
default Optional<Object> getHandle() {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,6 @@ import lombok.NonNull;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import me.lucko.luckperms.api.Tristate;
|
import me.lucko.luckperms.api.Tristate;
|
||||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
|
||||||
import me.lucko.luckperms.common.config.LuckPermsConfiguration;
|
|
||||||
import me.lucko.luckperms.common.constants.Constants;
|
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
|
|
||||||
import net.kyori.text.Component;
|
import net.kyori.text.Component;
|
||||||
@ -51,10 +48,10 @@ public abstract class SenderFactory<T> {
|
|||||||
@Getter(AccessLevel.PROTECTED)
|
@Getter(AccessLevel.PROTECTED)
|
||||||
private final LuckPermsPlugin plugin;
|
private final LuckPermsPlugin plugin;
|
||||||
|
|
||||||
protected abstract String getName(T t);
|
|
||||||
|
|
||||||
protected abstract UUID getUuid(T t);
|
protected abstract UUID getUuid(T t);
|
||||||
|
|
||||||
|
protected abstract String getName(T t);
|
||||||
|
|
||||||
protected abstract void sendMessage(T t, String s);
|
protected abstract void sendMessage(T t, String s);
|
||||||
|
|
||||||
protected abstract void sendMessage(T t, Component message);
|
protected abstract void sendMessage(T t, Component message);
|
||||||
@ -63,16 +60,6 @@ public abstract class SenderFactory<T> {
|
|||||||
|
|
||||||
protected abstract boolean hasPermission(T t, String node);
|
protected abstract boolean hasPermission(T t, String node);
|
||||||
|
|
||||||
protected String getConsoleName() {
|
|
||||||
LuckPermsConfiguration config = getPlugin().getConfiguration();
|
|
||||||
return config == null ? Constants.CONSOLE_NAME.apply(null) : Constants.CONSOLE_NAME.apply(config.get(ConfigKeys.SERVER));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getImportName() {
|
|
||||||
LuckPermsConfiguration config = getPlugin().getConfiguration();
|
|
||||||
return config == null ? Constants.IMPORT_NAME.apply(null) : Constants.IMPORT_NAME.apply(config.get(ConfigKeys.SERVER));
|
|
||||||
}
|
|
||||||
|
|
||||||
public final Sender wrap(@NonNull T sender) {
|
public final Sender wrap(@NonNull T sender) {
|
||||||
return new AbstractSender<>(plugin, this, sender);
|
return new AbstractSender<>(plugin, this, sender);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ package me.lucko.luckperms.common.constants;
|
|||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Random constants used throughout the plugin implementation.
|
* Random constants used throughout the plugin implementation.
|
||||||
@ -37,10 +36,10 @@ import java.util.function.Function;
|
|||||||
public class Constants {
|
public class Constants {
|
||||||
|
|
||||||
public static final UUID CONSOLE_UUID = UUID.fromString("00000000-0000-0000-0000-000000000000");
|
public static final UUID CONSOLE_UUID = UUID.fromString("00000000-0000-0000-0000-000000000000");
|
||||||
public static final Function<String, String> CONSOLE_NAME = s -> s == null || s.equalsIgnoreCase("global") ? "Console" : "console@" + s;
|
public static final String CONSOLE_NAME = "Console";
|
||||||
|
|
||||||
public static final UUID IMPORT_UUID = UUID.fromString("11111111-1111-1111-1111-111111111111");
|
public static final UUID IMPORT_UUID = UUID.fromString("11111111-1111-1111-1111-111111111111");
|
||||||
public static final Function<String, String> IMPORT_NAME = s -> s == null || s.equalsIgnoreCase("global") ? "Import" : "import@" + s;
|
public static final String IMPORT_NAME = "Import";
|
||||||
|
|
||||||
public static final char COLOR_CHAR = '\u00A7';
|
public static final char COLOR_CHAR = '\u00A7';
|
||||||
public static final char FORMAT_CHAR = '&';
|
public static final char FORMAT_CHAR = '&';
|
||||||
|
@ -194,7 +194,7 @@ public class VerboseListener {
|
|||||||
.add("| End Time | " + endDate + " |")
|
.add("| End Time | " + endDate + " |")
|
||||||
.add("| Duration | " + duration +" |")
|
.add("| Duration | " + duration +" |")
|
||||||
.add("| Count | **" + matchedCounter.get() + "** / " + counter.get() + " |")
|
.add("| Count | **" + matchedCounter.get() + "** / " + counter.get() + " |")
|
||||||
.add("| User | " + notifiedSender.getName() + " |")
|
.add("| User | " + notifiedSender.getNameWithLocation() + " |")
|
||||||
.add("| Filter | " + filter + " |")
|
.add("| Filter | " + filter + " |")
|
||||||
.add("| Include traces | " + showTraces + " |")
|
.add("| Include traces | " + showTraces + " |")
|
||||||
.add("");
|
.add("");
|
||||||
|
@ -456,24 +456,7 @@ public class LPSpongePlugin implements LuckPermsPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public Sender getConsoleSender() {
|
public Sender getConsoleSender() {
|
||||||
if (!game.isServerAvailable()) {
|
if (!game.isServerAvailable()) {
|
||||||
return new ImporterSender(this) {
|
return new ImporterSender(this, Constants.CONSOLE_UUID, Constants.CONSOLE_NAME) {
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
LuckPermsConfiguration config = getPlatform().getConfiguration();
|
|
||||||
return config == null ? Constants.CONSOLE_NAME.apply(null) : Constants.CONSOLE_NAME.apply(config.get(ConfigKeys.SERVER));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID getUuid() {
|
|
||||||
return Constants.CONSOLE_UUID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isImport() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void consumeMessage(String s) {
|
protected void consumeMessage(String s) {
|
||||||
logger.info(s);
|
logger.info(s);
|
||||||
|
@ -51,7 +51,7 @@ public class SpongeSenderFactory extends SenderFactory<CommandSource> {
|
|||||||
if (source instanceof Player) {
|
if (source instanceof Player) {
|
||||||
return source.getName();
|
return source.getName();
|
||||||
}
|
}
|
||||||
return getConsoleName();
|
return Constants.CONSOLE_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user