mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-29 12:37:40 +01:00
Fix legacy codes in formatted holder display names
This commit is contained in:
parent
703b18e51c
commit
2c7ff2120c
@ -78,7 +78,7 @@ public final class StorageAssistant {
|
||||
plugin.getStorage().saveUser(user).get();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Message.USER_SAVE_ERROR.send(sender, user.getFormattedDisplayName());
|
||||
Message.USER_SAVE_ERROR.send(sender, user);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ public final class StorageAssistant {
|
||||
plugin.getStorage().saveGroup(group).get();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Message.GROUP_SAVE_ERROR.send(sender, group.getFormattedDisplayName());
|
||||
Message.GROUP_SAVE_ERROR.send(sender, group);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ public class MetaAddChatMeta extends GenericChildCommand {
|
||||
|
||||
DataMutateResult result = target.setNode(DataType.NORMAL, this.type.builder(meta, priority).withContext(context).build(), true);
|
||||
if (result.wasSuccessful()) {
|
||||
Message.ADD_CHATMETA_SUCCESS.send(sender, target.getFormattedDisplayName(), this.type, meta, priority, context);
|
||||
Message.ADD_CHATMETA_SUCCESS.send(sender, target, this.type, meta, priority, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("meta" , "add" + this.type.name().toLowerCase(), priority, meta, context)
|
||||
@ -106,7 +106,7 @@ public class MetaAddChatMeta extends GenericChildCommand {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_HAS_CHAT_META.send(sender, target.getFormattedDisplayName(), this.type, meta, priority, context);
|
||||
Message.ALREADY_HAS_CHAT_META.send(sender, target, this.type, meta, priority, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class MetaAddTempChatMeta extends GenericChildCommand {
|
||||
if (result.getResult().wasSuccessful()) {
|
||||
duration = result.getMergedNode().getExpiryDuration();
|
||||
|
||||
Message.ADD_TEMP_CHATMETA_SUCCESS.send(sender, target.getFormattedDisplayName(), this.type, meta, priority, duration, context);
|
||||
Message.ADD_TEMP_CHATMETA_SUCCESS.send(sender, target, this.type, meta, priority, duration, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("meta" , "addtemp" + this.type.name().toLowerCase(), priority, meta, duration, context)
|
||||
@ -114,7 +114,7 @@ public class MetaAddTempChatMeta extends GenericChildCommand {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_HAS_TEMP_CHAT_META.send(sender, target.getFormattedDisplayName(), this.type, meta, priority, context);
|
||||
Message.ALREADY_HAS_TEMP_CHAT_META.send(sender, target, this.type, meta, priority, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class MetaClear extends GenericChildCommand {
|
||||
}
|
||||
|
||||
int changed = before - target.normalData().size();
|
||||
Message.META_CLEAR_SUCCESS.send(sender, target.getFormattedDisplayName(), type.name().toLowerCase(), context, changed);
|
||||
Message.META_CLEAR_SUCCESS.send(sender, target, type.name().toLowerCase(), context, changed);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("meta", "clear", context)
|
||||
|
@ -89,27 +89,27 @@ public class MetaInfo extends GenericChildCommand {
|
||||
}
|
||||
|
||||
if (prefixes.isEmpty()) {
|
||||
Message.CHAT_META_PREFIX_NONE.send(sender, target.getFormattedDisplayName());
|
||||
Message.CHAT_META_PREFIX_NONE.send(sender, target);
|
||||
} else {
|
||||
Message.CHAT_META_PREFIX_HEADER.send(sender, target.getFormattedDisplayName());
|
||||
Message.CHAT_META_PREFIX_HEADER.send(sender, target);
|
||||
for (Map.Entry<Integer, PrefixNode> e : prefixes) {
|
||||
Message.CHAT_META_ENTRY.send(sender, e.getValue(), target, label);
|
||||
}
|
||||
}
|
||||
|
||||
if (suffixes.isEmpty()) {
|
||||
Message.CHAT_META_SUFFIX_NONE.send(sender, target.getFormattedDisplayName());
|
||||
Message.CHAT_META_SUFFIX_NONE.send(sender, target);
|
||||
} else {
|
||||
Message.CHAT_META_SUFFIX_HEADER.send(sender, target.getFormattedDisplayName());
|
||||
Message.CHAT_META_SUFFIX_HEADER.send(sender, target);
|
||||
for (Map.Entry<Integer, SuffixNode> e : suffixes) {
|
||||
Message.CHAT_META_ENTRY.send(sender, e.getValue(), target, label);
|
||||
}
|
||||
}
|
||||
|
||||
if (meta.isEmpty()) {
|
||||
Message.META_NONE.send(sender, target.getFormattedDisplayName());
|
||||
Message.META_NONE.send(sender, target);
|
||||
} else {
|
||||
Message.META_HEADER.send(sender, target.getFormattedDisplayName());
|
||||
Message.META_HEADER.send(sender, target);
|
||||
for (MetaNode node : meta) {
|
||||
Message.META_ENTRY.send(sender, node, target, label);
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class MetaRemoveChatMeta extends GenericChildCommand {
|
||||
// Handle bulk removal
|
||||
if (meta.equalsIgnoreCase("null") || meta.equals("*")) {
|
||||
target.removeIf(DataType.NORMAL, context, this.type.nodeType().predicate(n -> n.getPriority() == priority && !n.hasExpiry()), false);
|
||||
Message.BULK_REMOVE_CHATMETA_SUCCESS.send(sender, target.getFormattedDisplayName(), this.type, priority, context);
|
||||
Message.BULK_REMOVE_CHATMETA_SUCCESS.send(sender, target, this.type, priority, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("meta" , "remove" + this.type.name().toLowerCase(), priority, "*", context)
|
||||
@ -111,7 +111,7 @@ public class MetaRemoveChatMeta extends GenericChildCommand {
|
||||
DataMutateResult result = target.unsetNode(DataType.NORMAL, this.type.builder(meta, priority).withContext(context).build());
|
||||
|
||||
if (result.wasSuccessful()) {
|
||||
Message.REMOVE_CHATMETA_SUCCESS.send(sender, target.getFormattedDisplayName(), this.type, meta, priority, context);
|
||||
Message.REMOVE_CHATMETA_SUCCESS.send(sender, target, this.type, meta, priority, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("meta" , "remove" + this.type.name().toLowerCase(), priority, meta, context)
|
||||
@ -120,7 +120,7 @@ public class MetaRemoveChatMeta extends GenericChildCommand {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOES_NOT_HAVE_CHAT_META.send(sender, target.getFormattedDisplayName(), this.type, meta, priority, context);
|
||||
Message.DOES_NOT_HAVE_CHAT_META.send(sender, target, this.type, meta, priority, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class MetaRemoveTempChatMeta extends GenericChildCommand {
|
||||
// Handle bulk removal
|
||||
if (meta.equalsIgnoreCase("null") || meta.equals("*")) {
|
||||
target.removeIf(DataType.NORMAL, context, this.type.nodeType().predicate(n -> n.getPriority() == priority && n.hasExpiry()), false);
|
||||
Message.BULK_REMOVE_TEMP_CHATMETA_SUCCESS.send(sender, target.getFormattedDisplayName(), this.type, priority, context);
|
||||
Message.BULK_REMOVE_TEMP_CHATMETA_SUCCESS.send(sender, target, this.type, priority, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("meta" , "removetemp" + this.type.name().toLowerCase(), priority, "*", context)
|
||||
@ -111,7 +111,7 @@ public class MetaRemoveTempChatMeta extends GenericChildCommand {
|
||||
DataMutateResult result = target.unsetNode(DataType.NORMAL, this.type.builder(meta, priority).expiry(10L).withContext(context).build());
|
||||
|
||||
if (result.wasSuccessful()) {
|
||||
Message.REMOVE_TEMP_CHATMETA_SUCCESS.send(sender, target.getFormattedDisplayName(), this.type, meta, priority, context);
|
||||
Message.REMOVE_TEMP_CHATMETA_SUCCESS.send(sender, target, this.type, meta, priority, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("meta" , "removetemp" + this.type.name().toLowerCase(), priority, meta, context)
|
||||
@ -120,7 +120,7 @@ public class MetaRemoveTempChatMeta extends GenericChildCommand {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOES_NOT_HAVE_TEMP_CHAT_META.send(sender, target.getFormattedDisplayName(), this.type, meta, priority, context);
|
||||
Message.DOES_NOT_HAVE_TEMP_CHAT_META.send(sender, target, this.type, meta, priority, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -77,14 +77,14 @@ public class MetaSet extends GenericChildCommand {
|
||||
Node node = Meta.builder(key, value).withContext(context).build();
|
||||
|
||||
if (target.hasNode(DataType.NORMAL, node, NodeEqualityPredicate.IGNORE_EXPIRY_TIME_AND_VALUE).asBoolean()) {
|
||||
Message.ALREADY_HAS_META.send(sender, target.getFormattedDisplayName(), key, value, context);
|
||||
Message.ALREADY_HAS_META.send(sender, target, key, value, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
|
||||
target.removeIf(DataType.NORMAL, context, NodeType.META.predicate(n -> !n.hasExpiry() && n.getMetaKey().equalsIgnoreCase(key)), false);
|
||||
target.setNode(DataType.NORMAL, node, true);
|
||||
|
||||
Message.SET_META_SUCCESS.send(sender, key, value, target.getFormattedDisplayName(), context);
|
||||
Message.SET_META_SUCCESS.send(sender, key, value, target, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("meta", "set", key, value, context)
|
||||
|
@ -132,7 +132,7 @@ public class MetaSetChatMeta extends GenericChildCommand {
|
||||
|
||||
DataMutateResult result = target.setNode(DataType.NORMAL, this.type.builder(meta, priority).withContext(context).build(), true);
|
||||
if (result.wasSuccessful()) {
|
||||
Message.ADD_CHATMETA_SUCCESS.send(sender, target.getFormattedDisplayName(), this.type, meta, priority, context);
|
||||
Message.ADD_CHATMETA_SUCCESS.send(sender, target, this.type, meta, priority, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("meta" , "set" + this.type.name().toLowerCase(), priority, meta, context)
|
||||
@ -141,7 +141,7 @@ public class MetaSetChatMeta extends GenericChildCommand {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_HAS_CHAT_META.send(sender, target.getFormattedDisplayName(), this.type, meta, priority, context);
|
||||
Message.ALREADY_HAS_CHAT_META.send(sender, target, this.type, meta, priority, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -82,14 +82,14 @@ public class MetaSetTemp extends GenericChildCommand {
|
||||
Node node = Meta.builder(key, value).withContext(context).expiry(duration).build();
|
||||
|
||||
if (target.hasNode(DataType.NORMAL, node, NodeEqualityPredicate.IGNORE_EXPIRY_TIME_AND_VALUE).asBoolean()) {
|
||||
Message.ALREADY_HAS_TEMP_META.send(sender, target.getFormattedDisplayName(), key, value, context);
|
||||
Message.ALREADY_HAS_TEMP_META.send(sender, target, key, value, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
|
||||
target.removeIf(DataType.NORMAL, context, NodeType.META.predicate(n -> n.hasExpiry() && n.getMetaKey().equalsIgnoreCase(key)), false);
|
||||
duration = target.setNode(DataType.NORMAL, node, modifier).getMergedNode().getExpiryDuration();
|
||||
|
||||
Message.SET_META_TEMP_SUCCESS.send(sender, key, value, target.getFormattedDisplayName(), duration, context);
|
||||
Message.SET_META_TEMP_SUCCESS.send(sender, key, value, target, duration, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("meta", "settemp", key, value, duration, context)
|
||||
|
@ -144,7 +144,7 @@ public class MetaSetTempChatMeta extends GenericChildCommand {
|
||||
if (result.getResult().wasSuccessful()) {
|
||||
duration = result.getMergedNode().getExpiryDuration();
|
||||
|
||||
Message.ADD_TEMP_CHATMETA_SUCCESS.send(sender, target.getFormattedDisplayName(), this.type, meta, priority, duration, context);
|
||||
Message.ADD_TEMP_CHATMETA_SUCCESS.send(sender, target, this.type, meta, priority, duration, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("meta" , "settemp" + this.type.name().toLowerCase(), priority, meta, duration, context)
|
||||
@ -153,7 +153,7 @@ public class MetaSetTempChatMeta extends GenericChildCommand {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_HAS_TEMP_CHAT_META.send(sender, target.getFormattedDisplayName(), this.type, meta, priority, context);
|
||||
Message.ALREADY_HAS_TEMP_CHAT_META.send(sender, target, this.type, meta, priority, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class MetaUnset extends GenericChildCommand {
|
||||
}
|
||||
|
||||
if (target.removeIf(DataType.NORMAL, context, NodeType.META.predicate(n -> !n.hasExpiry() && n.getMetaKey().equalsIgnoreCase(key)), false)) {
|
||||
Message.UNSET_META_SUCCESS.send(sender, key, target.getFormattedDisplayName(), context);
|
||||
Message.UNSET_META_SUCCESS.send(sender, key, target, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("meta", "unset", key, context)
|
||||
@ -80,7 +80,7 @@ public class MetaUnset extends GenericChildCommand {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOESNT_HAVE_META.send(sender, target.getFormattedDisplayName(), key, context);
|
||||
Message.DOESNT_HAVE_META.send(sender, target, key, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class MetaUnsetTemp extends GenericChildCommand {
|
||||
}
|
||||
|
||||
if (target.removeIf(DataType.NORMAL, context, NodeType.META.predicate(n -> n.hasExpiry() && n.getMetaKey().equalsIgnoreCase(key)), false)) {
|
||||
Message.UNSET_META_TEMP_SUCCESS.send(sender, key, target.getFormattedDisplayName(), context);
|
||||
Message.UNSET_META_TEMP_SUCCESS.send(sender, key, target, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("meta", "unsettemp", key, context)
|
||||
@ -80,7 +80,7 @@ public class MetaUnsetTemp extends GenericChildCommand {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOESNT_HAVE_TEMP_META.send(sender, target.getFormattedDisplayName(), key, context);
|
||||
Message.DOESNT_HAVE_TEMP_META.send(sender, target, key, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public class HolderClear<T extends PermissionHolder> extends ChildCommand<T> {
|
||||
}
|
||||
|
||||
int changed = before - target.normalData().size();
|
||||
Message.CLEAR_SUCCESS.send(sender, target.getFormattedDisplayName(), context, changed);
|
||||
Message.CLEAR_SUCCESS.send(sender, target, context, changed);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("clear", context)
|
||||
|
@ -103,7 +103,7 @@ public class HolderEditor<T extends PermissionHolder> extends ChildCommand<T> {
|
||||
users.values().stream()
|
||||
.sorted(Comparator
|
||||
.<User>comparingInt(u -> u.getCachedData().getMetaData(QueryOptions.nonContextual()).getWeight(MetaCheckEvent.Origin.INTERNAL)).reversed()
|
||||
.thenComparing(User::getFormattedDisplayName, String.CASE_INSENSITIVE_ORDER)
|
||||
.thenComparing(User::getPlainDisplayName, String.CASE_INSENSITIVE_ORDER)
|
||||
)
|
||||
.forEach(holders::add);
|
||||
|
||||
|
@ -110,11 +110,11 @@ public class HolderShowTracks<T extends PermissionHolder> extends ChildCommand<T
|
||||
}
|
||||
|
||||
if (lines.isEmpty()) {
|
||||
Message.LIST_TRACKS_EMPTY.send(sender, target.getFormattedDisplayName());
|
||||
Message.LIST_TRACKS_EMPTY.send(sender, target);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
Message.LIST_TRACKS.send(sender, target.getFormattedDisplayName());
|
||||
Message.LIST_TRACKS.send(sender, target);
|
||||
for (Map.Entry<Track, Component> line : lines) {
|
||||
Message.LIST_TRACKS_ENTRY.send(sender, line.getKey().getName(), line.getValue());
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class ParentAdd extends GenericChildCommand {
|
||||
DataMutateResult result = target.setNode(DataType.NORMAL, Inheritance.builder(group.getName()).withContext(context).build(), true);
|
||||
|
||||
if (result.wasSuccessful()) {
|
||||
Message.SET_INHERIT_SUCCESS.send(sender, target.getFormattedDisplayName(), group.getFormattedDisplayName(), context);
|
||||
Message.SET_INHERIT_SUCCESS.send(sender, target, group, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("parent", "add", group.getName(), context)
|
||||
@ -91,7 +91,7 @@ public class ParentAdd extends GenericChildCommand {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_INHERITS.send(sender, target.getFormattedDisplayName(), group.getFormattedDisplayName(), context);
|
||||
Message.ALREADY_INHERITS.send(sender, target, group, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class ParentAddTemp extends GenericChildCommand {
|
||||
}
|
||||
|
||||
if (group.getName().equalsIgnoreCase(target.getObjectName())) {
|
||||
Message.ALREADY_TEMP_INHERITS.send(sender, target.getFormattedDisplayName(), group.getFormattedDisplayName(), context);
|
||||
Message.ALREADY_TEMP_INHERITS.send(sender, target, group, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ public class ParentAddTemp extends GenericChildCommand {
|
||||
|
||||
if (result.getResult().wasSuccessful()) {
|
||||
duration = result.getMergedNode().getExpiryDuration();
|
||||
Message.SET_TEMP_INHERIT_SUCCESS.send(sender, target.getFormattedDisplayName(), group.getFormattedDisplayName(), duration, context);
|
||||
Message.SET_TEMP_INHERIT_SUCCESS.send(sender, target, group, duration, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("parent", "addtemp", group.getName(), duration, context)
|
||||
@ -102,7 +102,7 @@ public class ParentAddTemp extends GenericChildCommand {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_TEMP_INHERITS.send(sender, target.getFormattedDisplayName(), group.getFormattedDisplayName(), context);
|
||||
Message.ALREADY_TEMP_INHERITS.send(sender, target, group, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class ParentClear extends GenericChildCommand {
|
||||
}
|
||||
|
||||
int changed = before - target.normalData().size();
|
||||
Message.PARENT_CLEAR_SUCCESS.send(sender, target.getFormattedDisplayName(), context, changed);
|
||||
Message.PARENT_CLEAR_SUCCESS.send(sender, target, context, changed);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("parent", "clear", context)
|
||||
|
@ -98,7 +98,7 @@ public class ParentClearTrack extends GenericChildCommand {
|
||||
}
|
||||
|
||||
int changed = before - target.normalData().size();
|
||||
Message.PARENT_CLEAR_TRACK_SUCCESS.send(sender, target.getFormattedDisplayName(), track.getName(), context, changed);
|
||||
Message.PARENT_CLEAR_TRACK_SUCCESS.send(sender, target, track.getName(), context, changed);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("parent", "cleartrack", track.getName(), context)
|
||||
|
@ -73,7 +73,7 @@ public class ParentInfo extends GenericChildCommand {
|
||||
|
||||
// handle empty
|
||||
if (nodes.isEmpty()) {
|
||||
Message.PARENT_INFO_NO_DATA.send(sender, target.getFormattedDisplayName());
|
||||
Message.PARENT_INFO_NO_DATA.send(sender, target);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ public class ParentInfo extends GenericChildCommand {
|
||||
List<InheritanceNode> content = pages.get(pageIndex);
|
||||
|
||||
// send header
|
||||
Message.PARENT_INFO.send(sender, target.getFormattedDisplayName(), page, pages.size(), nodes.size());
|
||||
Message.PARENT_INFO.send(sender, target, page, pages.size(), nodes.size());
|
||||
|
||||
// send content
|
||||
for (InheritanceNode node : content) {
|
||||
|
@ -48,6 +48,7 @@ import me.lucko.luckperms.common.sender.Sender;
|
||||
import me.lucko.luckperms.common.storage.misc.DataConstraints;
|
||||
import me.lucko.luckperms.common.util.Predicates;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.luckperms.api.context.MutableContextSet;
|
||||
import net.luckperms.api.model.data.DataMutateResult;
|
||||
import net.luckperms.api.model.data.DataType;
|
||||
@ -93,7 +94,7 @@ public class ParentRemove extends GenericChildCommand {
|
||||
|
||||
DataMutateResult result = target.unsetNode(DataType.NORMAL, Inheritance.builder(groupName).withContext(context).build());
|
||||
if (result.wasSuccessful()) {
|
||||
Message.UNSET_INHERIT_SUCCESS.send(sender, target.getFormattedDisplayName(), groupName, context);
|
||||
Message.UNSET_INHERIT_SUCCESS.send(sender, target, Component.text(groupName), context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("parent", "remove", groupName, context)
|
||||
@ -106,7 +107,7 @@ public class ParentRemove extends GenericChildCommand {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOES_NOT_INHERIT.send(sender, target.getFormattedDisplayName(), groupName, context);
|
||||
Message.DOES_NOT_INHERIT.send(sender, target, Component.text(groupName), context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ import me.lucko.luckperms.common.sender.Sender;
|
||||
import me.lucko.luckperms.common.storage.misc.DataConstraints;
|
||||
import me.lucko.luckperms.common.util.Predicates;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.luckperms.api.context.MutableContextSet;
|
||||
import net.luckperms.api.model.data.DataMutateResult;
|
||||
import net.luckperms.api.model.data.DataType;
|
||||
@ -82,13 +83,13 @@ public class ParentRemoveTemp extends GenericChildCommand {
|
||||
Node mergedNode = result.getMergedNode();
|
||||
//noinspection ConstantConditions
|
||||
if (mergedNode != null) {
|
||||
Message.UNSET_TEMP_INHERIT_SUBTRACT_SUCCESS.send(sender, target.getFormattedDisplayName(), groupName, mergedNode.getExpiryDuration(), context, duration);
|
||||
Message.UNSET_TEMP_INHERIT_SUBTRACT_SUCCESS.send(sender, target, Component.text(groupName), mergedNode.getExpiryDuration(), context, duration);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("parent", "removetemp", groupName, duration, context)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
Message.UNSET_TEMP_INHERIT_SUCCESS.send(sender, target.getFormattedDisplayName(), groupName, context);
|
||||
Message.UNSET_TEMP_INHERIT_SUCCESS.send(sender, target, Component.text(groupName), context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("parent", "removetemp", groupName, context)
|
||||
@ -98,7 +99,7 @@ public class ParentRemoveTemp extends GenericChildCommand {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOES_NOT_TEMP_INHERIT.send(sender, target.getFormattedDisplayName(), groupName, context);
|
||||
Message.DOES_NOT_TEMP_INHERIT.send(sender, target, Component.text(groupName), context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public class ParentSet extends GenericChildCommand {
|
||||
((User) target).getPrimaryGroup().setStoredValue(group.getName());
|
||||
}
|
||||
|
||||
Message.SET_PARENT_SUCCESS.send(sender, target.getFormattedDisplayName(), group.getFormattedDisplayName(), context);
|
||||
Message.SET_PARENT_SUCCESS.send(sender, target, group, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("parent", "set", group.getName(), context)
|
||||
|
@ -115,7 +115,7 @@ public class ParentSetTrack extends GenericChildCommand {
|
||||
target.removeIf(DataType.NORMAL, context, NodeType.INHERITANCE.predicate(n -> track.containsGroup(n.getGroupName())), false);
|
||||
target.setNode(DataType.NORMAL, Inheritance.builder(group.getName()).withContext(context).build(), true);
|
||||
|
||||
Message.SET_TRACK_PARENT_SUCCESS.send(sender, target.getFormattedDisplayName(), track.getName(), group.getFormattedDisplayName(), context);
|
||||
Message.SET_TRACK_PARENT_SUCCESS.send(sender, target, track.getName(), group, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("parent", "settrack", track.getName(), groupName, context)
|
||||
|
@ -90,18 +90,18 @@ public class UserSwitchPrimaryGroup extends GenericChildCommand {
|
||||
}
|
||||
|
||||
if (user.getPrimaryGroup().getStoredValue().orElse(GroupManager.DEFAULT_GROUP_NAME).equalsIgnoreCase(group.getName())) {
|
||||
Message.USER_PRIMARYGROUP_ERROR_ALREADYHAS.send(sender, user.getFormattedDisplayName(), group.getFormattedDisplayName());
|
||||
Message.USER_PRIMARYGROUP_ERROR_ALREADYHAS.send(sender, user, group);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
|
||||
Node node = Inheritance.builder(group.getName()).build();
|
||||
if (!user.hasNode(DataType.NORMAL, node, NodeEqualityPredicate.IGNORE_VALUE).asBoolean()) {
|
||||
Message.USER_PRIMARYGROUP_ERROR_NOTMEMBER.send(sender, user.getFormattedDisplayName(), group.getName());
|
||||
Message.USER_PRIMARYGROUP_ERROR_NOTMEMBER.send(sender, user, group);
|
||||
target.setNode(DataType.NORMAL, node, true);
|
||||
}
|
||||
|
||||
user.getPrimaryGroup().setStoredValue(group.getName());
|
||||
Message.USER_PRIMARYGROUP_SUCCESS.send(sender, user.getFormattedDisplayName(), group.getFormattedDisplayName());
|
||||
Message.USER_PRIMARYGROUP_SUCCESS.send(sender, user, group);
|
||||
|
||||
LoggedAction.build().source(sender).target(user)
|
||||
.description("parent", "switchprimarygroup", group.getName())
|
||||
|
@ -64,7 +64,7 @@ public class PermissionCheck extends GenericChildCommand {
|
||||
MutableContextSet context = args.getContextOrDefault(1, plugin);
|
||||
|
||||
Tristate result = target.hasNode(DataType.NORMAL, NodeBuilders.determineMostApplicable(node).withContext(context).build(), NodeEqualityPredicate.IGNORE_VALUE_OR_IF_TEMPORARY);
|
||||
Message.CHECK_PERMISSION.send(sender, target.getFormattedDisplayName(), node, result, context);
|
||||
Message.CHECK_PERMISSION.send(sender, target, node, result, context);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class PermissionCheckInherits extends GenericChildCommand {
|
||||
}
|
||||
|
||||
Tristate result = match.map(n -> Tristate.of(n.getValue())).orElse(Tristate.UNDEFINED);
|
||||
Message.CHECK_INHERITS_PERMISSION.send(sender, target.getFormattedDisplayName(), node, result, context, location);
|
||||
Message.CHECK_INHERITS_PERMISSION.send(sender, target, node, result, context, location);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ public class PermissionClear extends GenericChildCommand {
|
||||
target.removeIf(DataType.NORMAL, context.isEmpty() ? null : context, NodeType.PERMISSION::matches, false);
|
||||
|
||||
int changed = before - target.normalData().size();
|
||||
Message.PERMISSION_CLEAR_SUCCESS.send(sender, target.getFormattedDisplayName(), context, changed);
|
||||
Message.PERMISSION_CLEAR_SUCCESS.send(sender, target, context, changed);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("permission", "clear", context)
|
||||
|
@ -73,7 +73,7 @@ public class PermissionInfo extends GenericChildCommand {
|
||||
|
||||
// handle empty
|
||||
if (nodes.isEmpty()) {
|
||||
Message.PERMISSION_INFO_NO_DATA.send(sender, target.getFormattedDisplayName());
|
||||
Message.PERMISSION_INFO_NO_DATA.send(sender, target);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ public class PermissionInfo extends GenericChildCommand {
|
||||
List<Node> content = pages.get(pageIndex);
|
||||
|
||||
// send header
|
||||
Message.PERMISSION_INFO.send(sender, target.getFormattedDisplayName(), page, pages.size(), nodes.size());
|
||||
Message.PERMISSION_INFO.send(sender, target, page, pages.size(), nodes.size());
|
||||
|
||||
// send content
|
||||
for (Node node : content) {
|
||||
|
@ -86,7 +86,7 @@ public class PermissionSet extends GenericChildCommand {
|
||||
DataMutateResult result = target.setNode(DataType.NORMAL, builtNode, true);
|
||||
|
||||
if (result.wasSuccessful()) {
|
||||
Message.SETPERMISSION_SUCCESS.send(sender, node, value, target.getFormattedDisplayName(), context);
|
||||
Message.SETPERMISSION_SUCCESS.send(sender, node, value, target, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("permission", "set", node, value, context)
|
||||
@ -95,7 +95,7 @@ public class PermissionSet extends GenericChildCommand {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_HASPERMISSION.send(sender, target.getFormattedDisplayName(), node, context);
|
||||
Message.ALREADY_HASPERMISSION.send(sender, target, node, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class PermissionSetTemp extends GenericChildCommand {
|
||||
|
||||
if (result.getResult().wasSuccessful()) {
|
||||
duration = result.getMergedNode().getExpiryDuration();
|
||||
Message.SETPERMISSION_TEMP_SUCCESS.send(sender, node, value, target.getFormattedDisplayName(), duration, context);
|
||||
Message.SETPERMISSION_TEMP_SUCCESS.send(sender, node, value, target, duration, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("permission", "settemp", node, value, duration, context)
|
||||
@ -101,7 +101,7 @@ public class PermissionSetTemp extends GenericChildCommand {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_HAS_TEMP_PERMISSION.send(sender, target.getFormattedDisplayName(), node, context);
|
||||
Message.ALREADY_HAS_TEMP_PERMISSION.send(sender, target, node, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class PermissionUnset extends GenericChildCommand {
|
||||
DataMutateResult result = target.unsetNode(DataType.NORMAL, builtNode);
|
||||
|
||||
if (result.wasSuccessful()) {
|
||||
Message.UNSETPERMISSION_SUCCESS.send(sender, node, target.getFormattedDisplayName(), context);
|
||||
Message.UNSETPERMISSION_SUCCESS.send(sender, node, target, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("permission", "unset", node, context)
|
||||
@ -94,7 +94,7 @@ public class PermissionUnset extends GenericChildCommand {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOES_NOT_HAVE_PERMISSION.send(sender, target.getFormattedDisplayName(), node, context);
|
||||
Message.DOES_NOT_HAVE_PERMISSION.send(sender, target, node, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -90,13 +90,13 @@ public class PermissionUnsetTemp extends GenericChildCommand {
|
||||
Node mergedNode = result.getMergedNode();
|
||||
//noinspection ConstantConditions
|
||||
if (mergedNode != null) {
|
||||
Message.UNSET_TEMP_PERMISSION_SUBTRACT_SUCCESS.send(sender, mergedNode.getKey(), mergedNode.getValue(), target.getFormattedDisplayName(), mergedNode.getExpiryDuration(), context, duration);
|
||||
Message.UNSET_TEMP_PERMISSION_SUBTRACT_SUCCESS.send(sender, mergedNode.getKey(), mergedNode.getValue(), target, mergedNode.getExpiryDuration(), context, duration);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("permission", "unsettemp", node, duration, context)
|
||||
.build().submit(plugin, sender);
|
||||
} else {
|
||||
Message.UNSET_TEMP_PERMISSION_SUCCESS.send(sender, node, target.getFormattedDisplayName(), context);
|
||||
Message.UNSET_TEMP_PERMISSION_SUCCESS.send(sender, node, target, context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("permission", "unsettemp", node, context)
|
||||
@ -106,7 +106,7 @@ public class PermissionUnsetTemp extends GenericChildCommand {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOES_NOT_HAVE_TEMP_PERMISSION.send(sender, target.getFormattedDisplayName(), node, context);
|
||||
Message.DOES_NOT_HAVE_TEMP_PERMISSION.send(sender, target, node, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ import me.lucko.luckperms.common.sender.Sender;
|
||||
import me.lucko.luckperms.common.storage.misc.DataConstraints;
|
||||
import me.lucko.luckperms.common.util.Predicates;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.luckperms.api.actionlog.Action;
|
||||
import net.luckperms.api.event.cause.CreationCause;
|
||||
|
||||
@ -67,11 +68,11 @@ public class CreateGroup extends SingleCommand {
|
||||
plugin.getStorage().createAndLoadGroup(groupName, CreationCause.COMMAND).get();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Message.CREATE_ERROR.send(sender, groupName);
|
||||
Message.CREATE_ERROR.send(sender, Component.text(groupName));
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
Message.CREATE_SUCCESS.send(sender, groupName);
|
||||
Message.CREATE_SUCCESS.send(sender, Component.text(groupName));
|
||||
|
||||
LoggedAction.build().source(sender).targetName(groupName).targetType(Action.Target.Type.GROUP)
|
||||
.description("create")
|
||||
|
@ -74,7 +74,7 @@ public class GroupClone extends ChildCommand<Group> {
|
||||
|
||||
newGroup.setNodes(DataType.NORMAL, target.normalData().asList());
|
||||
|
||||
Message.CLONE_SUCCESS.send(sender, target.getName(), newGroup.getName());
|
||||
Message.CLONE_SUCCESS.send(sender, target.getFormattedDisplayName(), newGroup.getFormattedDisplayName());
|
||||
|
||||
LoggedAction.build().source(sender).target(newGroup)
|
||||
.description("clone", target.getName())
|
||||
|
@ -39,6 +39,7 @@ import me.lucko.luckperms.common.sender.Sender;
|
||||
import me.lucko.luckperms.common.storage.misc.DataConstraints;
|
||||
import me.lucko.luckperms.common.util.Predicates;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.luckperms.api.event.cause.CreationCause;
|
||||
import net.luckperms.api.event.cause.DeletionCause;
|
||||
import net.luckperms.api.model.data.DataType;
|
||||
@ -66,7 +67,7 @@ public class GroupRename extends ChildCommand<Group> {
|
||||
newGroup = plugin.getStorage().createAndLoadGroup(newGroupName, CreationCause.COMMAND).get();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Message.CREATE_ERROR.send(sender, newGroupName);
|
||||
Message.CREATE_ERROR.send(sender, Component.text(newGroupName));
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
@ -80,7 +81,7 @@ public class GroupRename extends ChildCommand<Group> {
|
||||
|
||||
newGroup.setNodes(DataType.NORMAL, target.normalData().asList());
|
||||
|
||||
Message.RENAME_SUCCESS.send(sender, target.getName(), newGroup.getName());
|
||||
Message.RENAME_SUCCESS.send(sender, target.getFormattedDisplayName(), newGroup.getFormattedDisplayName());
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("rename", newGroup.getName())
|
||||
|
@ -61,7 +61,7 @@ public class GroupSetWeight extends ChildCommand<Group> {
|
||||
target.removeIf(DataType.NORMAL, null, NodeType.WEIGHT::matches, false);
|
||||
target.setNode(DataType.NORMAL, Weight.builder(weight).build(), true);
|
||||
|
||||
Message.GROUP_SET_WEIGHT.send(sender, weight, target.getFormattedDisplayName());
|
||||
Message.GROUP_SET_WEIGHT.send(sender, weight, target);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("setweight", weight)
|
||||
|
@ -62,7 +62,7 @@ public class ListGroups extends SingleCommand {
|
||||
})
|
||||
.forEach(group -> {
|
||||
List<String> tracks = plugin.getTrackManager().getAll().values().stream().filter(t -> t.containsGroup(group)).map(Track::getName).collect(Collectors.toList());
|
||||
Message.GROUPS_LIST_ENTRY.send(sender, group.getFormattedDisplayName(), group.getWeight().orElse(0), tracks);
|
||||
Message.GROUPS_LIST_ENTRY.send(sender, group, group.getWeight().orElse(0), tracks);
|
||||
});
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
|
@ -70,7 +70,7 @@ public class CheckCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
Tristate tristate = user.getCachedData().getPermissionData(user.getQueryOptions()).checkPermission(permission, PermissionCheckEvent.Origin.INTERNAL).result();
|
||||
Message.CHECK_RESULT.send(sender, user.getFormattedDisplayName(), permission, tristate);
|
||||
Message.CHECK_RESULT.send(sender, user, permission, tristate);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ public class EditorCommand extends SingleCommand {
|
||||
users.values().stream()
|
||||
.sorted(Comparator
|
||||
.<User>comparingInt(u -> u.getCachedData().getMetaData(QueryOptions.nonContextual()).getWeight(MetaCheckEvent.Origin.INTERNAL)).reversed()
|
||||
.thenComparing(User::getFormattedDisplayName, String.CASE_INSENSITIVE_ORDER)
|
||||
.thenComparing(User::getPlainDisplayName, String.CASE_INSENSITIVE_ORDER)
|
||||
)
|
||||
.forEach(holders::add);
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ import me.lucko.luckperms.common.sender.Sender;
|
||||
import me.lucko.luckperms.common.storage.misc.DataConstraints;
|
||||
import me.lucko.luckperms.common.util.Predicates;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.luckperms.api.actionlog.Action;
|
||||
import net.luckperms.api.event.cause.CreationCause;
|
||||
|
||||
@ -67,11 +68,11 @@ public class CreateTrack extends SingleCommand {
|
||||
plugin.getStorage().createAndLoadTrack(trackName, CreationCause.COMMAND).get();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Message.CREATE_ERROR.send(sender, trackName);
|
||||
Message.CREATE_ERROR.send(sender, Component.text(trackName));
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
Message.CREATE_SUCCESS.send(sender, trackName);
|
||||
Message.CREATE_SUCCESS.send(sender, Component.text(trackName));
|
||||
|
||||
LoggedAction.build().source(sender).targetName(trackName).targetType(Action.Target.Type.TRACK)
|
||||
.description("create").build()
|
||||
|
@ -39,6 +39,7 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.sender.Sender;
|
||||
import me.lucko.luckperms.common.util.Predicates;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.luckperms.api.actionlog.Action;
|
||||
import net.luckperms.api.event.cause.DeletionCause;
|
||||
|
||||
@ -67,11 +68,11 @@ public class DeleteTrack extends SingleCommand {
|
||||
plugin.getStorage().deleteTrack(track, DeletionCause.COMMAND).get();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Message.DELETE_ERROR.send(sender, track.getName());
|
||||
Message.DELETE_ERROR.send(sender, Component.text(track.getName()));
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
Message.DELETE_SUCCESS.send(sender, trackName);
|
||||
Message.DELETE_SUCCESS.send(sender, Component.text(trackName));
|
||||
|
||||
LoggedAction.build().source(sender).targetName(trackName).targetType(Action.Target.Type.TRACK)
|
||||
.description("delete")
|
||||
|
@ -79,7 +79,7 @@ public class TrackAppend extends ChildCommand<Track> {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.TRACK_ALREADY_CONTAINS.send(sender, target.getName(), group.getName());
|
||||
Message.TRACK_ALREADY_CONTAINS.send(sender, target.getName(), group);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ import me.lucko.luckperms.common.sender.Sender;
|
||||
import me.lucko.luckperms.common.storage.misc.DataConstraints;
|
||||
import me.lucko.luckperms.common.util.Predicates;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.luckperms.api.event.cause.CreationCause;
|
||||
|
||||
public class TrackClone extends ChildCommand<Track> {
|
||||
@ -62,7 +63,7 @@ public class TrackClone extends ChildCommand<Track> {
|
||||
|
||||
newTrack.setGroups(target.getGroups());
|
||||
|
||||
Message.CLONE_SUCCESS.send(sender, target.getName(), newTrack.getName());
|
||||
Message.CLONE_SUCCESS.send(sender, Component.text(target.getName()), Component.text(newTrack.getName()));
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("clone", newTrack.getName())
|
||||
|
@ -88,7 +88,7 @@ public class TrackInsert extends ChildCommand<Track> {
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.TRACK_ALREADY_CONTAINS.send(sender, target.getName(), group.getName());
|
||||
Message.TRACK_ALREADY_CONTAINS.send(sender, target.getName(), group);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ import me.lucko.luckperms.common.sender.Sender;
|
||||
import me.lucko.luckperms.common.storage.misc.DataConstraints;
|
||||
import me.lucko.luckperms.common.util.Predicates;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.luckperms.api.event.cause.CreationCause;
|
||||
import net.luckperms.api.event.cause.DeletionCause;
|
||||
|
||||
@ -65,7 +66,7 @@ public class TrackRename extends ChildCommand<Track> {
|
||||
newTrack = plugin.getStorage().createAndLoadTrack(newTrackName, CreationCause.COMMAND).get();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Message.CREATE_ERROR.send(sender, newTrackName);
|
||||
Message.CREATE_ERROR.send(sender, Component.text(newTrackName));
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
@ -73,13 +74,13 @@ public class TrackRename extends ChildCommand<Track> {
|
||||
plugin.getStorage().deleteTrack(target, DeletionCause.COMMAND).get();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Message.DELETE_ERROR.send(sender, target.getName());
|
||||
Message.DELETE_ERROR.send(sender, Component.text(target.getName()));
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
newTrack.setGroups(target.getGroups());
|
||||
|
||||
Message.RENAME_SUCCESS.send(sender, target.getName(), newTrack.getName());
|
||||
Message.RENAME_SUCCESS.send(sender, Component.text(target.getName()), Component.text(newTrack.getName()));
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("rename", newTrack.getName())
|
||||
|
@ -109,10 +109,10 @@ public class UserDemote extends ChildCommand<User> {
|
||||
DemotionResult result = track.demote(target, context, previousGroupPermissionChecker, sender, removeFromFirst);
|
||||
switch (result.getStatus()) {
|
||||
case NOT_ON_TRACK:
|
||||
Message.USER_TRACK_ERROR_NOT_CONTAIN_GROUP.send(sender, target.getFormattedDisplayName(), track.getName());
|
||||
Message.USER_TRACK_ERROR_NOT_CONTAIN_GROUP.send(sender, target, track.getName());
|
||||
return CommandResult.FAILURE;
|
||||
case AMBIGUOUS_CALL:
|
||||
Message.TRACK_AMBIGUOUS_CALL.send(sender, target.getFormattedDisplayName());
|
||||
Message.TRACK_AMBIGUOUS_CALL.send(sender, target);
|
||||
return CommandResult.FAILURE;
|
||||
case UNDEFINED_FAILURE:
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
@ -123,11 +123,11 @@ public class UserDemote extends ChildCommand<User> {
|
||||
|
||||
case REMOVED_FROM_FIRST_GROUP: {
|
||||
if (!removeFromFirst && !result.getGroupFrom().isPresent()) {
|
||||
Message.USER_DEMOTE_ENDOFTRACK_NOT_REMOVED.send(sender, track.getName(), target.getFormattedDisplayName());
|
||||
Message.USER_DEMOTE_ENDOFTRACK_NOT_REMOVED.send(sender, track.getName(), target);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
|
||||
Message.USER_DEMOTE_ENDOFTRACK.send(sender, track.getName(), target.getFormattedDisplayName(), result.getGroupFrom().get());
|
||||
Message.USER_DEMOTE_ENDOFTRACK.send(sender, track.getName(), target, result.getGroupFrom().get());
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("demote", track.getName(), context)
|
||||
@ -141,7 +141,7 @@ public class UserDemote extends ChildCommand<User> {
|
||||
String groupFrom = result.getGroupFrom().get();
|
||||
String groupTo = result.getGroupTo().get();
|
||||
|
||||
Message.USER_DEMOTE_SUCCESS.send(sender, target.getFormattedDisplayName(), track.getName(), groupFrom, groupTo, context);
|
||||
Message.USER_DEMOTE_SUCCESS.send(sender, target, track.getName(), groupFrom, groupTo, context);
|
||||
if (!dontShowTrackProgress) {
|
||||
Message.TRACK_PATH_HIGHLIGHTED_PROGRESSION.send(sender, track.getGroups(), groupTo, groupFrom, true);
|
||||
}
|
||||
|
@ -115,19 +115,19 @@ public class UserPromote extends ChildCommand<User> {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
case AMBIGUOUS_CALL:
|
||||
Message.TRACK_AMBIGUOUS_CALL.send(sender, target.getFormattedDisplayName());
|
||||
Message.TRACK_AMBIGUOUS_CALL.send(sender, target);
|
||||
return CommandResult.FAILURE;
|
||||
case END_OF_TRACK:
|
||||
Message.USER_PROMOTE_ERROR_ENDOFTRACK.send(sender, track.getName(), target.getFormattedDisplayName());
|
||||
Message.USER_PROMOTE_ERROR_ENDOFTRACK.send(sender, track.getName(), target);
|
||||
return CommandResult.STATE_ERROR;
|
||||
|
||||
case ADDED_TO_FIRST_GROUP: {
|
||||
if (!addToFirst && !result.getGroupTo().isPresent()) {
|
||||
Message.USER_PROMOTE_NOT_ON_TRACK.send(sender, track.getName(), target.getFormattedDisplayName());
|
||||
Message.USER_PROMOTE_NOT_ON_TRACK.send(sender, target, track.getName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
|
||||
Message.USER_TRACK_ADDED_TO_FIRST.send(sender, target.getFormattedDisplayName(), track.getName(), result.getGroupTo().get(), context);
|
||||
Message.USER_TRACK_ADDED_TO_FIRST.send(sender, target, track.getName(), result.getGroupTo().get(), context);
|
||||
|
||||
LoggedAction.build().source(sender).target(target)
|
||||
.description("promote", track.getName(), context)
|
||||
@ -141,7 +141,7 @@ public class UserPromote extends ChildCommand<User> {
|
||||
String groupFrom = result.getGroupFrom().get();
|
||||
String groupTo = result.getGroupTo().get();
|
||||
|
||||
Message.USER_PROMOTE_SUCCESS.send(sender, target.getFormattedDisplayName(), track.getName(), groupFrom, groupTo, context);
|
||||
Message.USER_PROMOTE_SUCCESS.send(sender, target, track.getName(), groupFrom, groupTo, context);
|
||||
if (!dontShowTrackProgress) {
|
||||
Message.TRACK_PATH_HIGHLIGHTED_PROGRESSION.send(sender, track.getGroups(), groupFrom, groupTo, false);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -29,8 +29,11 @@ import me.lucko.luckperms.common.api.implementation.ApiGroup;
|
||||
import me.lucko.luckperms.common.cache.Cache;
|
||||
import me.lucko.luckperms.common.cacheddata.GroupCachedDataManager;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.luckperms.api.node.Node;
|
||||
import net.luckperms.api.node.types.DisplayNameNode;
|
||||
import net.luckperms.api.query.QueryOptions;
|
||||
@ -105,8 +108,22 @@ public class Group extends PermissionHolder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormattedDisplayName() {
|
||||
return getDisplayName().map(s -> this.name + " &r(" + s + "&r)").orElse(this.name);
|
||||
public Component getFormattedDisplayName() {
|
||||
String displayName = getDisplayName().orElse(null);
|
||||
if (displayName != null) {
|
||||
return Component.text()
|
||||
.content(this.name)
|
||||
.append(Component.space())
|
||||
.append(Component.text()
|
||||
.color(NamedTextColor.WHITE)
|
||||
.append(Message.OPEN_BRACKET)
|
||||
.append(Component.text(displayName))
|
||||
.append(Message.CLOSE_BRACKET)
|
||||
)
|
||||
.build();
|
||||
} else {
|
||||
return Component.text(this.name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -37,6 +37,7 @@ import me.lucko.luckperms.common.node.comparator.NodeWithContextComparator;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.query.DataSelector;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.luckperms.api.context.ContextSet;
|
||||
import net.luckperms.api.model.data.DataMutateResult;
|
||||
import net.luckperms.api.model.data.DataType;
|
||||
@ -201,7 +202,7 @@ public abstract class PermissionHolder {
|
||||
*
|
||||
* @return the holders formatted display name
|
||||
*/
|
||||
public abstract String getFormattedDisplayName();
|
||||
public abstract Component getFormattedDisplayName();
|
||||
|
||||
/**
|
||||
* Gets a display name for this permission holder, without any formatting.
|
||||
|
@ -30,6 +30,7 @@ import me.lucko.luckperms.common.cacheddata.UserCachedDataManager;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.luckperms.api.query.QueryOptions;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
@ -82,13 +83,13 @@ public class User extends PermissionHolder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormattedDisplayName() {
|
||||
return this.username != null ? this.username : this.uniqueId.toString();
|
||||
public Component getFormattedDisplayName() {
|
||||
return Component.text(getPlainDisplayName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlainDisplayName() {
|
||||
return getFormattedDisplayName();
|
||||
return this.username != null ? this.username : this.uniqueId.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,6 +45,7 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.sender.Sender;
|
||||
import me.lucko.luckperms.common.util.Uuids;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.luckperms.api.actionlog.Action;
|
||||
import net.luckperms.api.event.cause.CreationCause;
|
||||
import net.luckperms.api.event.cause.DeletionCause;
|
||||
@ -259,7 +260,7 @@ public class WebEditorResponse {
|
||||
.build().submit(this.plugin, this.sender);
|
||||
}
|
||||
|
||||
Message.APPLY_EDITS_SUCCESS.send(this.sender, "track", track.getName());
|
||||
Message.APPLY_EDITS_SUCCESS.send(this.sender, "track", Component.text(track.getName()));
|
||||
Message.APPLY_EDITS_SUCCESS_SUMMARY.send(this.sender, additions, deletions);
|
||||
Message.APPLY_EDITS_TRACK_BEFORE.send(this.sender, before);
|
||||
Message.APPLY_EDITS_TRACK_AFTER.send(this.sender, after);
|
||||
@ -283,7 +284,7 @@ public class WebEditorResponse {
|
||||
this.plugin.getStorage().deletePlayerData(uuid).get();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Message.DELETE_ERROR.send(this.sender, uuid.toString());
|
||||
Message.DELETE_ERROR.send(this.sender, Component.text(uuid.toString()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -365,11 +366,11 @@ public class WebEditorResponse {
|
||||
this.plugin.getStorage().deleteTrack(track, DeletionCause.COMMAND).get();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Message.DELETE_ERROR.send(this.sender, track.getName());
|
||||
Message.DELETE_ERROR.send(this.sender, Component.text(track.getName()));
|
||||
return true;
|
||||
}
|
||||
|
||||
Message.DELETE_SUCCESS.send(this.sender, trackName);
|
||||
Message.DELETE_SUCCESS.send(this.sender, Component.text(trackName));
|
||||
|
||||
LoggedAction.build().source(this.sender).target(track)
|
||||
.description("webeditor", "delete")
|
||||
|
Loading…
Reference in New Issue
Block a user