diff --git a/common/src/main/java/me/lucko/luckperms/common/command/utils/StorageAssistant.java b/common/src/main/java/me/lucko/luckperms/common/command/utils/StorageAssistant.java index 5badaa1e2..06627dd6c 100644 --- a/common/src/main/java/me/lucko/luckperms/common/command/utils/StorageAssistant.java +++ b/common/src/main/java/me/lucko/luckperms/common/command/utils/StorageAssistant.java @@ -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; } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddChatMeta.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddChatMeta.java index 974ffa237..7972566b0 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddChatMeta.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddChatMeta.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddTempChatMeta.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddTempChatMeta.java index ae3eac83e..839699c49 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddTempChatMeta.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddTempChatMeta.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaClear.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaClear.java index c6ce659b4..2615d1186 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaClear.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaClear.java @@ -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) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaInfo.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaInfo.java index 2843279ab..97907d9fd 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaInfo.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaInfo.java @@ -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 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 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); } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveChatMeta.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveChatMeta.java index d2c5a9d7d..e303734f2 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveChatMeta.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveChatMeta.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveTempChatMeta.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveTempChatMeta.java index 8362fb24d..9889bf24c 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveTempChatMeta.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveTempChatMeta.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSet.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSet.java index 9ec0f7f2e..82d3c7131 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSet.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSet.java @@ -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) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetChatMeta.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetChatMeta.java index 604f50d51..be0e3f874 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetChatMeta.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetChatMeta.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetTemp.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetTemp.java index 2578048bd..ab2e6082d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetTemp.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetTemp.java @@ -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) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetTempChatMeta.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetTempChatMeta.java index a83d4ae68..487bd7a75 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetTempChatMeta.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetTempChatMeta.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaUnset.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaUnset.java index 9492b164f..85c829667 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaUnset.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaUnset.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaUnsetTemp.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaUnsetTemp.java index 4fbc2ab31..6c50e4434 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaUnsetTemp.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaUnsetTemp.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/other/HolderClear.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/other/HolderClear.java index be3d1164c..0113a1819 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/other/HolderClear.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/other/HolderClear.java @@ -77,7 +77,7 @@ public class HolderClear extends ChildCommand { } 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) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/other/HolderEditor.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/other/HolderEditor.java index 628500b85..3676ccf7d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/other/HolderEditor.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/other/HolderEditor.java @@ -103,7 +103,7 @@ public class HolderEditor extends ChildCommand { users.values().stream() .sorted(Comparator .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); diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/other/HolderShowTracks.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/other/HolderShowTracks.java index a0ab4ff51..f6e9c609e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/other/HolderShowTracks.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/other/HolderShowTracks.java @@ -110,11 +110,11 @@ public class HolderShowTracks extends ChildCommand line : lines) { Message.LIST_TRACKS_ENTRY.send(sender, line.getKey().getName(), line.getValue()); } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAdd.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAdd.java index 5bd4a75cb..6d9c1f4ea 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAdd.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAdd.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAddTemp.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAddTemp.java index beb51da15..86214bcb8 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAddTemp.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAddTemp.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentClear.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentClear.java index e5e7c76c1..f2b612018 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentClear.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentClear.java @@ -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) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentClearTrack.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentClearTrack.java index f9e9aa73d..6787a87cc 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentClearTrack.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentClearTrack.java @@ -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) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentInfo.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentInfo.java index f7b08088e..29d34141a 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentInfo.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentInfo.java @@ -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 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) { diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentRemove.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentRemove.java index f23fd1c78..8727fd716 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentRemove.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentRemove.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentRemoveTemp.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentRemoveTemp.java index c249578a9..aaf93b991 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentRemoveTemp.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentRemoveTemp.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentSet.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentSet.java index fb180e82d..556f52e4e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentSet.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentSet.java @@ -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) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentSetTrack.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentSetTrack.java index 54817e23f..dbf8f180e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentSetTrack.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentSetTrack.java @@ -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) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/UserSwitchPrimaryGroup.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/UserSwitchPrimaryGroup.java index 88665dbe7..5d5b1ec9e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/UserSwitchPrimaryGroup.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/UserSwitchPrimaryGroup.java @@ -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()) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionCheck.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionCheck.java index aba036af6..2e593a3a7 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionCheck.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionCheck.java @@ -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; } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionCheckInherits.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionCheckInherits.java index 83f311fc3..4de0d5364 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionCheckInherits.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionCheckInherits.java @@ -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; } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionClear.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionClear.java index 4e052b6cd..d26d2be46 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionClear.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionClear.java @@ -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) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionInfo.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionInfo.java index 800a26cf4..0a04ac1ba 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionInfo.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionInfo.java @@ -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 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) { diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSet.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSet.java index ca87d3ce9..fb8d391df 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSet.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSet.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSetTemp.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSetTemp.java index 76311539b..f4dc614a2 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSetTemp.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSetTemp.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionUnset.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionUnset.java index 5e7234246..1726c8f7c 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionUnset.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionUnset.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionUnsetTemp.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionUnsetTemp.java index 9ed46173a..09a04498f 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionUnsetTemp.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionUnsetTemp.java @@ -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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/CreateGroup.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/CreateGroup.java index 3da86bc8d..030d4a6b5 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/CreateGroup.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/CreateGroup.java @@ -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") diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupClone.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupClone.java index ec4f8c361..abbad8ef9 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupClone.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupClone.java @@ -74,7 +74,7 @@ public class GroupClone extends ChildCommand { 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()) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupRename.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupRename.java index 5e7c7123a..12bf9bd61 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupRename.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupRename.java @@ -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 { 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 { 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()) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupSetWeight.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupSetWeight.java index f8a695550..262580863 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupSetWeight.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupSetWeight.java @@ -61,7 +61,7 @@ public class GroupSetWeight extends ChildCommand { 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) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/ListGroups.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/ListGroups.java index b30ad4dba..6bb4805c1 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/ListGroups.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/ListGroups.java @@ -62,7 +62,7 @@ public class ListGroups extends SingleCommand { }) .forEach(group -> { List 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; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/CheckCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/CheckCommand.java index 771340ec5..86e9a5c5a 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/CheckCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/CheckCommand.java @@ -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; } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/EditorCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/EditorCommand.java index 1e137c437..152bdbb90 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/EditorCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/EditorCommand.java @@ -146,7 +146,7 @@ public class EditorCommand extends SingleCommand { users.values().stream() .sorted(Comparator .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); } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/CreateTrack.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/CreateTrack.java index 28d100071..451a2ff05 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/CreateTrack.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/CreateTrack.java @@ -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() diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/DeleteTrack.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/DeleteTrack.java index ff43a4f69..fcb33563f 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/DeleteTrack.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/DeleteTrack.java @@ -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") diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackAppend.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackAppend.java index 8a06bb5a1..e4312f02e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackAppend.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackAppend.java @@ -79,7 +79,7 @@ public class TrackAppend extends ChildCommand { 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; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackClone.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackClone.java index 2aeabc0c3..1a5aa4abb 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackClone.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackClone.java @@ -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 { @@ -62,7 +63,7 @@ public class TrackClone extends ChildCommand { 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()) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackInsert.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackInsert.java index 413ceca1f..d8269fd1a 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackInsert.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackInsert.java @@ -88,7 +88,7 @@ public class TrackInsert extends ChildCommand { 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; } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRename.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRename.java index 28f86eb7a..675c15e08 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRename.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRename.java @@ -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 { 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 { 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()) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserDemote.java b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserDemote.java index 405f5fd43..04f39bfb6 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserDemote.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserDemote.java @@ -109,10 +109,10 @@ public class UserDemote extends ChildCommand { 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 { 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 { 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); } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserPromote.java b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserPromote.java index 81a84531e..ab2426564 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserPromote.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserPromote.java @@ -115,19 +115,19 @@ public class UserPromote extends ChildCommand { 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 { 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); } diff --git a/common/src/main/java/me/lucko/luckperms/common/locale/Message.java b/common/src/main/java/me/lucko/luckperms/common/locale/Message.java index 338168ea5..a4d8fc82e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/locale/Message.java +++ b/common/src/main/java/me/lucko/luckperms/common/locale/Message.java @@ -28,8 +28,10 @@ package me.lucko.luckperms.common.locale; import com.google.common.collect.Maps; import me.lucko.luckperms.common.actionlog.LoggedAction; +import me.lucko.luckperms.common.model.Group; import me.lucko.luckperms.common.model.HolderType; import me.lucko.luckperms.common.model.PermissionHolder; +import me.lucko.luckperms.common.model.User; import me.lucko.luckperms.common.node.factory.NodeCommandFactory; import me.lucko.luckperms.common.plugin.AbstractLuckPermsPlugin; import me.lucko.luckperms.common.plugin.LuckPermsPlugin; @@ -479,19 +481,19 @@ public interface Message { .append(FULL_STOP) ); - Args1 USER_SAVE_ERROR = id -> prefixed(translatable() + Args1 USER_SAVE_ERROR = user -> prefixed(translatable() // "&cThere was an error whilst saving user data for &4{}&c." .key("luckperms.command.misc.loading.error.user-save-error") .color(RED) - .args(text(id, DARK_RED)) + .args(text().color(DARK_RED).append(user.getFormattedDisplayName())) .append(FULL_STOP) ); - Args1 GROUP_SAVE_ERROR = id -> prefixed(translatable() + Args1 GROUP_SAVE_ERROR = group -> prefixed(translatable() // "&cThere was an error whilst saving group data for &4{}&c." .key("luckperms.command.misc.loading.error.group-save-error") .color(RED) - .args(text(id, DARK_RED)) + .args(text().color(DARK_RED).append(group.getFormattedDisplayName())) .append(FULL_STOP) ); @@ -913,11 +915,11 @@ public interface Message { .append(FULL_STOP) ); - Args2 APPLY_EDITS_SUCCESS = (type, name) -> prefixed(translatable() + Args2 APPLY_EDITS_SUCCESS = (type, name) -> prefixed(translatable() // "&aWeb editor data was applied to {} &b{}&a successfully." .key("luckperms.command.editor.apply-edits.success") .color(GREEN) - .args(text(type), text(name, AQUA)) + .args(text(type), text().color(AQUA).append(name)) .append(FULL_STOP) ); @@ -1055,84 +1057,112 @@ public interface Message { .append(FULL_STOP) ); - Args3 CHECK_RESULT = (user, permission, result) -> prefixed(translatable() + Args3 CHECK_RESULT = (user, permission, result) -> prefixed(translatable() // "&aPermission check result on user &b{}&a for permission &b{}&a: &f{}" .color(GREEN) .key("luckperms.command.check.result") - .args(text(user, AQUA), text(permission, AQUA)) + .args( + text().color(AQUA).append(user.getFormattedDisplayName()), + text(permission, AQUA) + ) .append(text(": ")) .append(formatTristate(result)) ); - Args1 CREATE_SUCCESS = name -> prefixed(translatable() + Args1 CREATE_SUCCESS = name -> prefixed(translatable() // "&b{}&a was successfully created." .color(GREEN) .key("luckperms.command.generic.create.success") - .args(text(name, AQUA)) + .args(text().color(AQUA).append(name)) .append(FULL_STOP) ); - Args1 DELETE_SUCCESS = name -> prefixed(translatable() + Args1 DELETE_SUCCESS = name -> prefixed(translatable() // "&b{}&a was successfully deleted." .color(GREEN) .key("luckperms.command.generic.delete.success") - .args(text(name, AQUA)) + .args(text().color(AQUA).append(name)) .append(FULL_STOP) ); - Args2 RENAME_SUCCESS = (from, to) -> prefixed(translatable() + Args2 RENAME_SUCCESS = (from, to) -> prefixed(translatable() // "&b{}&a was successfully renamed to &b{}&a." .color(GREEN) .key("luckperms.command.generic.rename.success") - .args(text(from, AQUA), text(to, AQUA)) + .args( + text().color(AQUA).append(from), + text().color(AQUA).append(to) + ) .append(FULL_STOP) ); - Args2 CLONE_SUCCESS = (from, to) -> prefixed(translatable() + Args2 CLONE_SUCCESS = (from, to) -> prefixed(translatable() // "&b{}&a was successfully cloned onto &b{}&a." .color(GREEN) .key("luckperms.command.generic.clone.success") - .args(text(from, AQUA), text(to, AQUA)) + .args( + text().color(AQUA).append(from), + text().color(AQUA).append(to) + ) .append(FULL_STOP) ); - Args3 ALREADY_INHERITS = (holder, group, context) -> prefixed(translatable() + Args3 ALREADY_INHERITS = (holder, group, context) -> prefixed(translatable() // "&b{}&a already inherits from &b{}&a in context {}&a." .color(GREEN) .key("luckperms.command.generic.parent.already-inherits") - .args(text(holder, AQUA), text(group, AQUA), formatContextSet(context)) + .args( + text().color(AQUA).append(holder.getFormattedDisplayName()), + text().color(AQUA).append(group.getFormattedDisplayName()), + formatContextSet(context) + ) .append(FULL_STOP) ); - Args3 DOES_NOT_INHERIT = (holder, group, context) -> prefixed(translatable() + Args3 DOES_NOT_INHERIT = (holder, group, context) -> prefixed(translatable() // "&b{}&a does not inherit from &b{}&a in context {}&a." .color(GREEN) .key("luckperms.command.generic.parent.doesnt-inherit") - .args(text(holder, AQUA), text(group, AQUA), formatContextSet(context)) + .args( + text().color(AQUA).append(holder.getFormattedDisplayName()), + text().color(AQUA).append(group), + formatContextSet(context) + ) .append(FULL_STOP) ); - Args3 ALREADY_TEMP_INHERITS = (holder, group, context) -> prefixed(translatable() + Args3 ALREADY_TEMP_INHERITS = (holder, group, context) -> prefixed(translatable() // "&b{}&a already temporarily inherits from &b{}&a in context {}&a." .color(GREEN) .key("luckperms.command.generic.parent.already-temp-inherits") - .args(text(holder, AQUA), text(group, AQUA), formatContextSet(context)) + .args( + text().color(AQUA).append(holder.getFormattedDisplayName()), + text().color(AQUA).append(group.getFormattedDisplayName()), + formatContextSet(context) + ) .append(FULL_STOP) ); - Args3 DOES_NOT_TEMP_INHERIT = (holder, group, context) -> prefixed(translatable() + Args3 DOES_NOT_TEMP_INHERIT = (holder, group, context) -> prefixed(translatable() // "&b{}&a does not temporarily inherit from &b{}&a in context {}&a." .color(GREEN) .key("luckperms.command.generic.parent.doesnt-temp-inherit") - .args(text(holder, AQUA), text(group, AQUA), formatContextSet(context)) + .args( + text().color(AQUA).append(holder.getFormattedDisplayName()), + text().color(AQUA).append(group), + formatContextSet(context) + ) .append(FULL_STOP) ); - Args2 TRACK_ALREADY_CONTAINS = (track, group) -> prefixed(translatable() + Args2 TRACK_ALREADY_CONTAINS = (track, group) -> prefixed(translatable() // "&b{}&a already contains &b{}&a." .color(GREEN) .key("luckperms.command.track.already-contains") - .args(text(track, AQUA), text(group, AQUA)) + .args( + text(track, AQUA), + text().color(AQUA).append(group.getFormattedDisplayName()) + ) .append(FULL_STOP) ); @@ -1144,11 +1174,11 @@ public interface Message { .append(FULL_STOP) ); - Args1 TRACK_AMBIGUOUS_CALL = name -> prefixed(translatable() + Args1 TRACK_AMBIGUOUS_CALL = user -> prefixed(translatable() // "&4{}&c is a member of multiple groups on this track. Unable to determine their location." .color(RED) .key("luckperms.command.track.error-multiple-groups") - .args(text(name, DARK_RED)) + .args(text().color(DARK_RED).append(user.getFormattedDisplayName())) .append(FULL_STOP) .append(space()) .append(translatable("luckperms.command.track.error-ambiguous")) @@ -1443,19 +1473,19 @@ public interface Message { )) ); - Args1 CREATE_ERROR = name -> prefixed(translatable() + Args1 CREATE_ERROR = name -> prefixed(translatable() // "&cThere was an error whilst creating &4{}&c." .key("luckperms.command.generic.create.error") .color(RED) - .args(text(name, DARK_RED)) + .args(text().color(DARK_RED).append(name)) .append(FULL_STOP) ); - Args1 DELETE_ERROR = name -> prefixed(translatable() + Args1 DELETE_ERROR = name -> prefixed(translatable() // "&cThere was an error whilst deleting &4{}&c." .key("luckperms.command.generic.delete.error") .color(RED) - .args(text(name, DARK_RED)) + .args(text().color(DARK_RED).append(name)) .append(FULL_STOP) ); @@ -1474,9 +1504,9 @@ public interface Message { .append(text("(name, weight, tracks)", GRAY)) ); - Args3> GROUPS_LIST_ENTRY = (name, weight, tracks) -> prefixed(text() + Args3> GROUPS_LIST_ENTRY = (group, weight, tracks) -> prefixed(text() .append(text("- ", WHITE)) - .append(text(name, DARK_AQUA)) + .append(text().color(DARK_AQUA).append(group.getFormattedDisplayName())) .append(text(" - ", GRAY)) .append(text(weight, AQUA)) .apply(builder -> { @@ -1495,12 +1525,12 @@ public interface Message { .append(formatStringList(list)) ); - Args4 PERMISSION_INFO = (holder, page, totalPages, totalEntries) -> prefixed(text() + Args4 PERMISSION_INFO = (holder, page, totalPages, totalEntries) -> prefixed(text() // "&b{}'s Permissions: &7(page &f{}&7 of &f{}&7 - &f{}&7 entries)" .color(AQUA) .append(translatable() .key("luckperms.command.generic.permission.info.title") - .args(text(holder)) + .args(holder.getFormattedDisplayName()) ) .append(text(':')) .append(text(" ")) @@ -1520,11 +1550,11 @@ public interface Message { ) ); - Args1 PERMISSION_INFO_NO_DATA = holder -> prefixed(translatable() + Args1 PERMISSION_INFO_NO_DATA = holder -> prefixed(translatable() // "&b{}&a does not have any permissions set." .key("luckperms.command.generic.permission.info.empty") .color(GREEN) - .args(text(holder, AQUA)) + .args(text().color(AQUA).append(holder.getFormattedDisplayName())) .append(FULL_STOP) ); @@ -1595,12 +1625,12 @@ public interface Message { .build() ); - Args4 PARENT_INFO = (holder, page, totalPages, totalEntries) -> prefixed(text() + Args4 PARENT_INFO = (holder, page, totalPages, totalEntries) -> prefixed(text() // "&b{}'s Parents: &7(page &f{}&7 of &f{}&7 - &f{}&7 entries)" .color(AQUA) .append(translatable() .key("luckperms.command.generic.parent.info.title") - .args(text(holder)) + .args(holder.getFormattedDisplayName()) ) .append(text(':')) .append(text(" ")) @@ -1620,11 +1650,11 @@ public interface Message { ) ); - Args1 PARENT_INFO_NO_DATA = holder -> prefixed(translatable() + Args1 PARENT_INFO_NO_DATA = holder -> prefixed(translatable() // "&b{}&a does not have any parents defined." .key("luckperms.command.generic.parent.info.empty") .color(GREEN) - .args(text(holder, AQUA)) + .args(text().color(AQUA).append(holder.getFormattedDisplayName())) .append(FULL_STOP) ); @@ -1700,11 +1730,11 @@ public interface Message { .build() ); - Args1 LIST_TRACKS = holder -> prefixed(translatable() + Args1 LIST_TRACKS = holder -> prefixed(translatable() // "&b{}'s Tracks:" .key("luckperms.command.generic.show-tracks.title") .color(AQUA) - .args(text(holder)) + .args(holder.getFormattedDisplayName()) .append(text(':')) ); @@ -1716,35 +1746,35 @@ public interface Message { .append(path) .build(); - Args1 LIST_TRACKS_EMPTY = holder -> prefixed(translatable() + Args1 LIST_TRACKS_EMPTY = holder -> prefixed(translatable() // "&b{}&a is not on any tracks." .key("luckperms.command.generic.show-tracks.empty") .color(GREEN) - .args(text(holder, AQUA)) + .args(text().color(AQUA).append(holder.getFormattedDisplayName())) .append(FULL_STOP) ); - Args4 CHECK_PERMISSION = (holder, permission, value, context) -> prefixed(translatable() + Args4 CHECK_PERMISSION = (holder, permission, value, context) -> prefixed(translatable() // "&b{}&a has permission &b{}&a set to {}&a in context {}&a." .key("luckperms.command.generic.permission.check-inherits") .color(GREEN) .args( text(permission, AQUA), formatTristate(value), - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), formatContextSet(context) ) .append(FULL_STOP) ); - Args5 CHECK_INHERITS_PERMISSION = (holder, permission, value, context, inheritedFrom) -> prefixed(translatable() + Args5 CHECK_INHERITS_PERMISSION = (holder, permission, value, context, inheritedFrom) -> prefixed(translatable() // "&b{}&a has permission &b{}&a set to {}&a in context {}&a. &7(inherited from &a{}&7)" .key("luckperms.command.generic.permission.check-inherits") .color(GREEN) .args( text(permission, AQUA), formatTristate(value), - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), formatContextSet(context) ) .append(FULL_STOP) @@ -1759,101 +1789,101 @@ public interface Message { ) ); - Args4 SETPERMISSION_SUCCESS = (permission, value, holder, context) -> prefixed(translatable() + Args4 SETPERMISSION_SUCCESS = (permission, value, holder, context) -> prefixed(translatable() // "&aSet &b{}&a to &b{}&a for &b{}&a in context {}&a." .key("luckperms.command.generic.permission.set") .color(GREEN) .args( text(permission, AQUA), text(value, AQUA), - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), formatContextSet(context) ) .append(FULL_STOP) ); - Args3 ALREADY_HASPERMISSION = (holder, permission, context) -> prefixed(translatable() + Args3 ALREADY_HASPERMISSION = (holder, permission, context) -> prefixed(translatable() // "&b{}&a already has &b{}&a set in context {}&a." .key("luckperms.command.generic.permission.already-has") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(permission, AQUA), formatContextSet(context) ) .append(FULL_STOP) ); - Args5 SETPERMISSION_TEMP_SUCCESS = (permission, value, holder, duration, context) -> prefixed(translatable() + Args5 SETPERMISSION_TEMP_SUCCESS = (permission, value, holder, duration, context) -> prefixed(translatable() // "&aSet &b{}&a to &b{}&a for &b{}&a for a duration of &b{}&a in context {}&a." .key("luckperms.command.generic.permission.set-temp") .color(GREEN) .args( text(permission, AQUA), text(value, AQUA), - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(DurationFormatter.LONG.format(duration), AQUA), formatContextSet(context) ) .append(FULL_STOP) ); - Args3 ALREADY_HAS_TEMP_PERMISSION = (holder, permission, context) -> prefixed(translatable() + Args3 ALREADY_HAS_TEMP_PERMISSION = (holder, permission, context) -> prefixed(translatable() // "&b{}&a already has &b{}&a set temporarily in context {}&a." .key("luckperms.command.generic.permission.already-has-temp") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(permission, AQUA), formatContextSet(context) ) .append(FULL_STOP) ); - Args3 UNSETPERMISSION_SUCCESS = (permission, holder, context) -> prefixed(translatable() + Args3 UNSETPERMISSION_SUCCESS = (permission, holder, context) -> prefixed(translatable() // "&aUnset &b{}&a for &b{}&a in context {}&a." .key("luckperms.command.generic.permission.unset") .color(GREEN) .args( text(permission, AQUA), - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), formatContextSet(context) ) .append(FULL_STOP) ); - Args3 DOES_NOT_HAVE_PERMISSION = (holder, permission, context) -> prefixed(translatable() + Args3 DOES_NOT_HAVE_PERMISSION = (holder, permission, context) -> prefixed(translatable() // "&b{}&a does not have &b{}&a set in context {}&a." .key("luckperms.command.generic.permission.doesnt-have") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(permission, AQUA), formatContextSet(context) ) .append(FULL_STOP) ); - Args3 UNSET_TEMP_PERMISSION_SUCCESS = (permission, holder, context) -> prefixed(translatable() + Args3 UNSET_TEMP_PERMISSION_SUCCESS = (permission, holder, context) -> prefixed(translatable() // "&aUnset temporary permission &b{}&a for &b{}&a in context {}&a." .key("luckperms.command.generic.permission.unset-temp") .color(GREEN) .args( text(permission, AQUA), - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), formatContextSet(context) ) .append(FULL_STOP) ); - Args6 UNSET_TEMP_PERMISSION_SUBTRACT_SUCCESS = (permission, value, holder, duration, context, durationLess) -> prefixed(translatable() + Args6 UNSET_TEMP_PERMISSION_SUBTRACT_SUCCESS = (permission, value, holder, duration, context, durationLess) -> prefixed(translatable() // "&aSet &b{}&a to &b{}&a for &b{}&a for a duration of &b{}&a in context {}&a, &b{}&a less than before." .key("luckperms.command.generic.permission.subtract") .color(GREEN) .args( text(permission, AQUA), text(value, AQUA), - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(DurationFormatter.LONG.format(duration), AQUA), formatContextSet(context), text(DurationFormatter.LONG.format(durationLess), AQUA) @@ -1861,99 +1891,99 @@ public interface Message { .append(FULL_STOP) ); - Args3 DOES_NOT_HAVE_TEMP_PERMISSION = (holder, permission, context) -> prefixed(translatable() + Args3 DOES_NOT_HAVE_TEMP_PERMISSION = (holder, permission, context) -> prefixed(translatable() // "&b{}&a does not have &b{}&a set temporarily in context {}&a." .key("luckperms.command.generic.permission.doesnt-have-temp") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(permission, AQUA), formatContextSet(context) ) .append(FULL_STOP) ); - Args3 SET_INHERIT_SUCCESS = (holder, parent, context) -> prefixed(translatable() + Args3 SET_INHERIT_SUCCESS = (holder, parent, context) -> prefixed(translatable() // "&b{}&a now inherits permissions from &b{}&a in context {}&a." .key("luckperms.command.generic.parent.add") .color(GREEN) .args( - text(holder, AQUA), - text(parent, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), + text().color(AQUA).append(parent.getFormattedDisplayName()), formatContextSet(context) ) .append(FULL_STOP) ); - Args4 SET_TEMP_INHERIT_SUCCESS = (holder, parent, duration, context) -> prefixed(translatable() + Args4 SET_TEMP_INHERIT_SUCCESS = (holder, parent, duration, context) -> prefixed(translatable() // "&b{}&a now inherits permissions from &b{}&a for a duration of &b{}&a in context {}&a." .key("luckperms.command.generic.parent.add-temp") .color(GREEN) .args( - text(holder, AQUA), - text(parent, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), + text().color(AQUA).append(parent.getFormattedDisplayName()), text(DurationFormatter.LONG.format(duration), AQUA), formatContextSet(context) ) .append(FULL_STOP) ); - Args3 SET_PARENT_SUCCESS = (holder, parent, context) -> prefixed(translatable() + Args3 SET_PARENT_SUCCESS = (holder, parent, context) -> prefixed(translatable() // "&b{}&a had their existing parent groups cleared, and now only inherits &b{}&a in context {}&a." .key("luckperms.command.generic.parent.set") .color(GREEN) .args( - text(holder, AQUA), - text(parent, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), + text().color(AQUA).append(parent.getFormattedDisplayName()), formatContextSet(context) ) .append(FULL_STOP) ); - Args4 SET_TRACK_PARENT_SUCCESS = (holder, track, parent, context) -> prefixed(translatable() + Args4 SET_TRACK_PARENT_SUCCESS = (holder, track, parent, context) -> prefixed(translatable() // "&b{}&a had their existing parent groups on track &b{}&a cleared, and now only inherits &b{}&a in context {}&a." .key("luckperms.command.generic.parent.set-track") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(track, AQUA), - text(parent, AQUA), + text().color(AQUA).append(parent.getFormattedDisplayName()), formatContextSet(context) ) .append(FULL_STOP) ); - Args3 UNSET_INHERIT_SUCCESS = (holder, parent, context) -> prefixed(translatable() + Args3 UNSET_INHERIT_SUCCESS = (holder, parent, context) -> prefixed(translatable() // "&b{}&a no longer inherits permissions from &b{}&a in context {}&a." .key("luckperms.command.generic.parent.remove") .color(GREEN) .args( - text(holder, AQUA), - text(parent, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), + text().color(AQUA).append(parent), formatContextSet(context) ) .append(FULL_STOP) ); - Args3 UNSET_TEMP_INHERIT_SUCCESS = (holder, parent, context) -> prefixed(translatable() + Args3 UNSET_TEMP_INHERIT_SUCCESS = (holder, parent, context) -> prefixed(translatable() // "&b{}&a no longer temporarily inherits permissions from &b{}&a in context {}&a." .key("luckperms.command.generic.parent.remove-temp") .color(GREEN) .args( - text(holder, AQUA), - text(parent, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), + text().color(AQUA).append(parent), formatContextSet(context) ) .append(FULL_STOP) ); - Args5 UNSET_TEMP_INHERIT_SUBTRACT_SUCCESS = (holder, parent, duration, context, durationLess) -> prefixed(translatable() + Args5 UNSET_TEMP_INHERIT_SUBTRACT_SUCCESS = (holder, parent, duration, context, durationLess) -> prefixed(translatable() // "&b{}&a will inherit permissions from &b{}&a for a duration of &b{}&a in context {}&a, &b{}&a less than before." .key("luckperms.command.generic.parent.subtract") .color(GREEN) .args( - text(holder, AQUA), - text(parent, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), + text().color(AQUA).append(parent), text(DurationFormatter.LONG.format(duration), AQUA), formatContextSet(context), text(DurationFormatter.LONG.format(durationLess), AQUA) @@ -1961,11 +1991,14 @@ public interface Message { .append(FULL_STOP) ); - Args3 CLEAR_SUCCESS = (holder, context, removeCount) -> prefixed(translatable() + Args3 CLEAR_SUCCESS = (holder, context, removeCount) -> prefixed(translatable() // "&b{}&a's nodes were cleared in context {}&a. (&b{}&a nodes were removed.)" .key("luckperms.command.generic.clear") .color(GREEN) - .args(text(holder, AQUA), formatContextSet(context)) + .args( + text().color(AQUA).append(holder.getFormattedDisplayName()), + formatContextSet(context) + ) .append(FULL_STOP) .append(space()) .append(text() @@ -1980,11 +2013,14 @@ public interface Message { ) ); - Args3 PERMISSION_CLEAR_SUCCESS = (holder, context, removeCount) -> prefixed(translatable() + Args3 PERMISSION_CLEAR_SUCCESS = (holder, context, removeCount) -> prefixed(translatable() // "&b{}&a's parents were cleared in context {}&a. (&b{}&a nodes were removed.)" .key("luckperms.command.generic.permission.clear") .color(GREEN) - .args(text(holder, AQUA), formatContextSet(context)) + .args( + text().color(AQUA).append(holder.getFormattedDisplayName()), + formatContextSet(context) + ) .append(FULL_STOP) .append(space()) .append(text() @@ -1999,11 +2035,14 @@ public interface Message { ) ); - Args3 PARENT_CLEAR_SUCCESS = (holder, context, removeCount) -> prefixed(translatable() + Args3 PARENT_CLEAR_SUCCESS = (holder, context, removeCount) -> prefixed(translatable() // "&b{}&a's parents were cleared in context {}&a. (&b{}&a nodes were removed.)" .key("luckperms.command.generic.parent.clear-track") .color(GREEN) - .args(text(holder, AQUA), formatContextSet(context)) + .args( + text().color(AQUA).append(holder.getFormattedDisplayName()), + formatContextSet(context) + ) .append(FULL_STOP) .append(space()) .append(text() @@ -2018,11 +2057,15 @@ public interface Message { ) ); - Args4 PARENT_CLEAR_TRACK_SUCCESS = (holder, track, context, removeCount) -> prefixed(translatable() + Args4 PARENT_CLEAR_TRACK_SUCCESS = (holder, track, context, removeCount) -> prefixed(translatable() // "&b{}&a's parents on track &b{}&a were cleared in context {}&a. (&b{}&a nodes were removed.)" .key("luckperms.command.generic.parent.clear-track") .color(GREEN) - .args(text(holder, AQUA), text(track, AQUA), formatContextSet(context)) + .args( + text().color(AQUA).append(holder.getFormattedDisplayName()), + text(track, AQUA), + formatContextSet(context) + ) .append(FULL_STOP) .append(space()) .append(text() @@ -2037,11 +2080,15 @@ public interface Message { ) ); - Args4 META_CLEAR_SUCCESS = (holder, key, context, removeCount) -> prefixed(translatable() + Args4 META_CLEAR_SUCCESS = (holder, key, context, removeCount) -> prefixed(translatable() // "&b{}&a's meta matching type &b{}&a was cleared in context {}&a. (&b{}&a nodes were removed.)" .key("luckperms.command.generic.meta.clear") .color(GREEN) - .args(text(holder, AQUA), text(key, AQUA), formatContextSet(context)) + .args( + text().color(AQUA).append(holder.getFormattedDisplayName()), + text(key, AQUA), + formatContextSet(context) + ) .append(FULL_STOP) .append(space()) .append(text() @@ -2070,25 +2117,25 @@ public interface Message { .color(RED) ); - Args1 CHAT_META_PREFIX_HEADER = holder -> prefixed(translatable() + Args1 CHAT_META_PREFIX_HEADER = holder -> prefixed(translatable() // "&b{}'s Prefixes" .key("luckperms.command.generic.chat-meta.info.title-prefix") .color(AQUA) - .args(text(holder)) + .args(holder.getFormattedDisplayName()) ); - Args1 CHAT_META_SUFFIX_HEADER = holder -> prefixed(translatable() + Args1 CHAT_META_SUFFIX_HEADER = holder -> prefixed(translatable() // "&b{}'s Suffixes" .key("luckperms.command.generic.chat-meta.info.title-suffix") .color(AQUA) - .args(text(holder)) + .args(holder.getFormattedDisplayName()) ); - Args1 META_HEADER = holder -> prefixed(translatable() + Args1 META_HEADER = holder -> prefixed(translatable() // "&b{}'s Meta" .key("luckperms.command.generic.meta.info.title") .color(AQUA) - .args(text(holder)) + .args(holder.getFormattedDisplayName()) ); Args3, PermissionHolder, String> CHAT_META_ENTRY = (node, holder, label) -> prefixed(text() @@ -2195,27 +2242,27 @@ public interface Message { }) )); - Args1 CHAT_META_PREFIX_NONE = holder -> prefixed(translatable() + Args1 CHAT_META_PREFIX_NONE = holder -> prefixed(translatable() // "&b{} has no prefixes." .key("luckperms.command.generic.chat-meta.info.none-prefix") .color(AQUA) - .args(text(holder)) + .args(holder.getFormattedDisplayName()) .append(FULL_STOP) ); - Args1 CHAT_META_SUFFIX_NONE = holder -> prefixed(translatable() + Args1 CHAT_META_SUFFIX_NONE = holder -> prefixed(translatable() // "&b{} has no suffixes." .key("luckperms.command.generic.chat-meta.info.none-suffix") .color(AQUA) - .args(text(holder)) + .args(holder.getFormattedDisplayName()) .append(FULL_STOP) ); - Args1 META_NONE = holder -> prefixed(translatable() + Args1 META_NONE = holder -> prefixed(translatable() // "&b{} has no meta." .key("luckperms.command.generic.meta.info.none") .color(AQUA) - .args(text(holder)) + .args(holder.getFormattedDisplayName()) .append(FULL_STOP) ); @@ -2230,12 +2277,12 @@ public interface Message { .append(FULL_STOP) ); - Args5 ALREADY_HAS_CHAT_META = (holder, type, value, priority, context) -> prefixed(translatable() + Args5 ALREADY_HAS_CHAT_META = (holder, type, value, priority, context) -> prefixed(translatable() // "&b{}&a already has {} &f'{}&f'&a set at a priority of &b{}&a in context {}&a." .key("luckperms.command.generic.chat-meta.already-has") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(type.toString()), text().color(WHITE).append(text('\'')).append(formatColoredValue(value)).append(text('\'')), text(priority, AQUA), @@ -2244,12 +2291,12 @@ public interface Message { .append(FULL_STOP) ); - Args5 ALREADY_HAS_TEMP_CHAT_META = (holder, type, value, priority, context) -> prefixed(translatable() + Args5 ALREADY_HAS_TEMP_CHAT_META = (holder, type, value, priority, context) -> prefixed(translatable() // "&b{}&a already has {} &f'{}&f'&a set temporarily at a priority of &b{}&a in context {}&a." .key("luckperms.command.generic.chat-meta.already-has-temp") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(type.toString()), text().color(WHITE).append(text('\'')).append(formatColoredValue(value)).append(text('\'')), text(priority, AQUA), @@ -2258,12 +2305,12 @@ public interface Message { .append(FULL_STOP) ); - Args5 DOES_NOT_HAVE_CHAT_META = (holder, type, value, priority, context) -> prefixed(translatable() + Args5 DOES_NOT_HAVE_CHAT_META = (holder, type, value, priority, context) -> prefixed(translatable() // "&b{}&a doesn't have {} &f'{}&f'&a set at a priority of &b{}&a in context {}&a." .key("luckperms.command.generic.chat-meta.doesnt-have") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(type.toString()), text().color(WHITE).append(text('\'')).append(formatColoredValue(value)).append(text('\'')), text(priority, AQUA), @@ -2272,12 +2319,12 @@ public interface Message { .append(FULL_STOP) ); - Args5 DOES_NOT_HAVE_TEMP_CHAT_META = (holder, type, value, priority, context) -> prefixed(translatable() + Args5 DOES_NOT_HAVE_TEMP_CHAT_META = (holder, type, value, priority, context) -> prefixed(translatable() // "&b{}&a doesn't have {} &f'{}&f'&a set temporarily at a priority of &b{}&a in context {}&a." .key("luckperms.command.generic.chat-meta.doesnt-have-temp") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(type.toString()), text().color(WHITE).append(text('\'')).append(formatColoredValue(value)).append(text('\'')), text(priority, AQUA), @@ -2286,12 +2333,12 @@ public interface Message { .append(FULL_STOP) ); - Args5 ADD_CHATMETA_SUCCESS = (holder, type, value, priority, context) -> prefixed(translatable() + Args5 ADD_CHATMETA_SUCCESS = (holder, type, value, priority, context) -> prefixed(translatable() // "&b{}&a had {} &f'{}&f'&a set at a priority of &b{}&a in context {}&a." .key("luckperms.command.generic.chat-meta.add") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(type.toString()), text().color(WHITE).append(text('\'')).append(formatColoredValue(value)).append(text('\'')), text(priority, AQUA), @@ -2300,12 +2347,12 @@ public interface Message { .append(FULL_STOP) ); - Args6 ADD_TEMP_CHATMETA_SUCCESS = (holder, type, value, priority, duration, context) -> prefixed(translatable() + Args6 ADD_TEMP_CHATMETA_SUCCESS = (holder, type, value, priority, duration, context) -> prefixed(translatable() // "&b{}&a had {} &f'{}&f'&a set at a priority of &b{}&a for a duration of &b{}&a in context {}&a." .key("luckperms.command.generic.chat-meta.add-temp") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(type.toString()), text().color(WHITE).append(text('\'')).append(formatColoredValue(value)).append(text('\'')), text(priority, AQUA), @@ -2315,12 +2362,12 @@ public interface Message { .append(FULL_STOP) ); - Args5 REMOVE_CHATMETA_SUCCESS = (holder, type, value, priority, context) -> prefixed(translatable() + Args5 REMOVE_CHATMETA_SUCCESS = (holder, type, value, priority, context) -> prefixed(translatable() // "&b{}&a had {} &f'{}&f'&a at priority &b{}&a removed in context {}&a." .key("luckperms.command.generic.chat-meta.remove") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(type.toString()), text().color(WHITE).append(text('\'')).append(formatColoredValue(value)).append(text('\'')), text(priority, AQUA), @@ -2329,12 +2376,12 @@ public interface Message { .append(FULL_STOP) ); - Args4 BULK_REMOVE_CHATMETA_SUCCESS = (holder, type, priority, context) -> prefixed(translatable() + Args4 BULK_REMOVE_CHATMETA_SUCCESS = (holder, type, priority, context) -> prefixed(translatable() // "&b{}&a had all {}es at priority &b{}&a removed in context {}&a." .key("luckperms.command.generic.chat-meta.remove-bulk") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(type.toString() + "es"), text(priority, AQUA), formatContextSet(context) @@ -2342,12 +2389,12 @@ public interface Message { .append(FULL_STOP) ); - Args5 REMOVE_TEMP_CHATMETA_SUCCESS = (holder, type, value, priority, context) -> prefixed(translatable() + Args5 REMOVE_TEMP_CHATMETA_SUCCESS = (holder, type, value, priority, context) -> prefixed(translatable() // "&b{}&a had temporary {} &f'{}&f'&a at priority &b{}&a removed in context {}&a." .key("luckperms.command.generic.chat-meta.remove-temp") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(type.toString()), text().color(WHITE).append(text('\'')).append(text(value)).append(text('\'')), text(priority, AQUA), @@ -2356,12 +2403,12 @@ public interface Message { .append(FULL_STOP) ); - Args4 BULK_REMOVE_TEMP_CHATMETA_SUCCESS = (holder, type, priority, context) -> prefixed(translatable() + Args4 BULK_REMOVE_TEMP_CHATMETA_SUCCESS = (holder, type, priority, context) -> prefixed(translatable() // "&b{}&a had all temporary {}es at priority &b{}&a removed in context {}&a." .key("luckperms.command.generic.chat-meta.remove-temp-bulk") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(type.toString() + "es"), text(priority, AQUA), formatContextSet(context) @@ -2369,12 +2416,12 @@ public interface Message { .append(FULL_STOP) ); - Args4 ALREADY_HAS_META = (holder, key, value, context) -> prefixed(translatable() + Args4 ALREADY_HAS_META = (holder, key, value, context) -> prefixed(translatable() // "&b{}&a already has meta key &f'{}&f'&a set to &f'{}&f'&a in context {}&a." .key("luckperms.command.generic.meta.already-has") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text().color(WHITE).append(text('\'')).append(text(key)).append(text('\'')), text().color(WHITE).append(text('\'')).append(formatColoredValue(value)).append(text('\'')), formatContextSet(context) @@ -2382,12 +2429,12 @@ public interface Message { .append(FULL_STOP) ); - Args4 ALREADY_HAS_TEMP_META = (holder, key, value, context) -> prefixed(translatable() + Args4 ALREADY_HAS_TEMP_META = (holder, key, value, context) -> prefixed(translatable() // "&b{}&a already has meta key &f'{}&f'&a temporarily set to &f'{}&f'&a in context {}&a." .key("luckperms.command.generic.meta.already-has-temp") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text().color(WHITE).append(text('\'')).append(text(key)).append(text('\'')), text().color(WHITE).append(text('\'')).append(formatColoredValue(value)).append(text('\'')), formatContextSet(context) @@ -2395,76 +2442,76 @@ public interface Message { .append(FULL_STOP) ); - Args3 DOESNT_HAVE_META = (holder, key, context) -> prefixed(translatable() + Args3 DOESNT_HAVE_META = (holder, key, context) -> prefixed(translatable() // "&b{}&a doesn't have meta key &f'{}&f'&a set in context {}&a." .key("luckperms.command.generic.meta.doesnt-have") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text().color(WHITE).append(text('\'')).append(text(key)).append(text('\'')), formatContextSet(context) ) .append(FULL_STOP) ); - Args3 DOESNT_HAVE_TEMP_META = (holder, key, context) -> prefixed(translatable() + Args3 DOESNT_HAVE_TEMP_META = (holder, key, context) -> prefixed(translatable() // "&b{}&a doesn't have meta key &f'{}&f'&a set temporarily in context {}&a." .key("luckperms.command.generic.meta.doesnt-have-temp") .color(GREEN) .args( - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text().color(WHITE).append(text('\'')).append(text(key)).append(text('\'')), formatContextSet(context) ) .append(FULL_STOP) ); - Args4 SET_META_SUCCESS = (key, value, holder, context) -> prefixed(translatable() + Args4 SET_META_SUCCESS = (key, value, holder, context) -> prefixed(translatable() // "&aSet meta key &f'{}&f'&a to &f'{}&f'&a for &b{}&a in context {}&a." .key("luckperms.command.generic.meta.set") .color(GREEN) .args( text().color(WHITE).append(text('\'')).append(text(key)).append(text('\'')), text().color(WHITE).append(text('\'')).append(formatColoredValue(value)).append(text('\'')), - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), formatContextSet(context) ) .append(FULL_STOP) ); - Args5 SET_META_TEMP_SUCCESS = (key, value, holder, duration, context) -> prefixed(translatable() + Args5 SET_META_TEMP_SUCCESS = (key, value, holder, duration, context) -> prefixed(translatable() // "&aSet meta key &f'{}&f'&a to &f'{}&f'&a for &b{}&a for a duration of &b{}&a in context {}&a." .key("luckperms.command.generic.meta.set-temp") .color(GREEN) .args( text().color(WHITE).append(text('\'')).append(text(key)).append(text('\'')), text().color(WHITE).append(text('\'')).append(formatColoredValue(value)).append(text('\'')), - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), text(DurationFormatter.LONG.format(duration), AQUA), formatContextSet(context) ) .append(FULL_STOP) ); - Args3 UNSET_META_SUCCESS = (key, holder, context) -> prefixed(translatable() + Args3 UNSET_META_SUCCESS = (key, holder, context) -> prefixed(translatable() // "&aUnset meta key &f'{}&f'&a for &b{}&a in context {}&a." .key("luckperms.command.generic.meta.unset") .color(GREEN) .args( text().color(WHITE).append(text('\'')).append(text(key)).append(text('\'')), - text(holder, AQUA), + text().color(AQUA).append(holder.getFormattedDisplayName()), formatContextSet(context) ) .append(FULL_STOP) ); - Args3 UNSET_META_TEMP_SUCCESS = (key, holder, context) -> prefixed(translatable() + Args3 UNSET_META_TEMP_SUCCESS = (key, holder, context) -> prefixed(translatable() // "&aUnset temporary meta key &f'{}&f'&a for &b{}&a in context {}&a." .key("luckperms.command.generic.meta.unset-temp") .color(GREEN) .args( text().color(WHITE).append(text('\'')).append(text(key)).append(text('\'')), - text(holder, BLUE), + text().color(AQUA).append(holder.getFormattedDisplayName()), formatContextSet(context) ) .append(FULL_STOP) @@ -2858,11 +2905,14 @@ public interface Message { .append(FULL_STOP) ); - Args2 USER_PRIMARYGROUP_SUCCESS = (user, group) -> prefixed(translatable() + Args2 USER_PRIMARYGROUP_SUCCESS = (user, group) -> prefixed(translatable() // "&b{}&a's primary group was set to &b{}&a." .key("luckperms.command.user.primarygroup.set") .color(GREEN) - .args(text(user, AQUA), text(group, AQUA)) + .args( + text().color(AQUA).append(user.getFormattedDisplayName()), + text().color(AQUA).append(group.getFormattedDisplayName()) + ) .append(FULL_STOP) ); @@ -2874,27 +2924,36 @@ public interface Message { .append(FULL_STOP) ); - Args2 USER_PRIMARYGROUP_ERROR_ALREADYHAS = (user, group) -> prefixed(translatable() + Args2 USER_PRIMARYGROUP_ERROR_ALREADYHAS = (user, group) -> prefixed(translatable() // "&b{}&a already has &b{}&a set as their primary group." .key("luckperms.command.user.primarygroup.already-has") .color(GREEN) - .args(text(user, AQUA), text(group, AQUA)) + .args( + text().color(AQUA).append(user.getFormattedDisplayName()), + text().color(AQUA).append(group.getFormattedDisplayName()) + ) .append(FULL_STOP) ); - Args2 USER_PRIMARYGROUP_ERROR_NOTMEMBER = (user, group) -> prefixed(translatable() + Args2 USER_PRIMARYGROUP_ERROR_NOTMEMBER = (user, group) -> prefixed(translatable() // "&b{}&a was not already a member of &b{}&a, adding them now." .key("luckperms.command.user.primarygroup.not-member") .color(GREEN) - .args(text(user, AQUA), text(group, AQUA)) + .args( + text().color(AQUA).append(user.getFormattedDisplayName()), + text().color(AQUA).append(group.getFormattedDisplayName()) + ) .append(FULL_STOP) ); - Args2 USER_TRACK_ERROR_NOT_CONTAIN_GROUP = (user, track) -> prefixed(translatable() + Args2 USER_TRACK_ERROR_NOT_CONTAIN_GROUP = (user, track) -> prefixed(translatable() // "&b{}&a isn't already in any groups on &b{}&a." .key("luckperms.command.user.track.error-not-contain-group") .color(GREEN) - .args(text(user, AQUA), text(track, AQUA)) + .args( + text().color(AQUA).append(user.getFormattedDisplayName()), + text(track, AQUA) + ) .append(FULL_STOP) ); @@ -2905,35 +2964,52 @@ public interface Message { .append(FULL_STOP) ); - Args4 USER_TRACK_ADDED_TO_FIRST = (user, track, group, context) -> prefixed(translatable() + Args4 USER_TRACK_ADDED_TO_FIRST = (user, track, group, context) -> prefixed(translatable() // "&b{}&a isn't in any groups on &b{}&a, so they were added to the first group, &b{}&a in context {}&a." .key("luckperms.command.user.promote.added-to-first") .color(GREEN) - .args(text(user, AQUA), text(track, AQUA), text(group, AQUA), formatContextSet(context)) + .args( + text().color(AQUA).append(user.getFormattedDisplayName()), + text(track, AQUA), + text(group, AQUA), + formatContextSet(context) + ) .append(FULL_STOP) ); - Args2 USER_PROMOTE_NOT_ON_TRACK = (user, track) -> prefixed(translatable() + Args2 USER_PROMOTE_NOT_ON_TRACK = (user, track) -> prefixed(translatable() // "&b{}&a isn't in any groups on &b{}&a, so was not promoted." .key("luckperms.command.user.demote.end-of-track-not-removed") .color(GREEN) - .args(text(user, AQUA), text(track, AQUA)) + .args( + text().color(AQUA).append(user.getFormattedDisplayName()), + text(track, AQUA) + ) .append(FULL_STOP) ); - Args5 USER_PROMOTE_SUCCESS = (user, track, from, to, context) -> prefixed(translatable() + Args5 USER_PROMOTE_SUCCESS = (user, track, from, to, context) -> prefixed(translatable() // "&aPromoting &b{}&a along track &b{}&a from &b{}&a to &b{}&a in context {}&a." .key("luckperms.command.user.promote.success") .color(GREEN) - .args(text(user, AQUA), text(track, AQUA), text(from, AQUA), text(to, AQUA), formatContextSet(context)) + .args( + text().color(AQUA).append(user.getFormattedDisplayName()), + text(track, AQUA), + text(from, AQUA), + text(to, AQUA), + formatContextSet(context) + ) .append(FULL_STOP) ); - Args2 USER_PROMOTE_ERROR_ENDOFTRACK = (track, user) -> prefixed(translatable() + Args2 USER_PROMOTE_ERROR_ENDOFTRACK = (track, user) -> prefixed(translatable() // "&aThe end of track &b{}&a was reached, unable to promote &b{}&a." .key("luckperms.command.user.promote.end-of-track") .color(GREEN) - .args(text(track, AQUA), text(user, AQUA)) + .args( + text(track, AQUA), + text().color(AQUA).append(user.getFormattedDisplayName()) + ) .append(FULL_STOP) ); @@ -2954,27 +3030,40 @@ public interface Message { .append(FULL_STOP)) ); - Args5 USER_DEMOTE_SUCCESS = (user, track, from, to, context) -> prefixed(translatable() + Args5 USER_DEMOTE_SUCCESS = (user, track, from, to, context) -> prefixed(translatable() // "&aDemoting &b{}&a along track &b{}&a from &b{}&a to &b{}&a in context {}&a." .key("luckperms.command.user.demote.success") .color(GREEN) - .args(text(user, AQUA), text(track, AQUA), text(from, AQUA), text(to, AQUA), formatContextSet(context)) + .args( + text().color(AQUA).append(user.getFormattedDisplayName()), + text(track, AQUA), + text(from, AQUA), + text(to, AQUA), + formatContextSet(context) + ) .append(FULL_STOP) ); - Args3 USER_DEMOTE_ENDOFTRACK = (track, user, group) -> prefixed(translatable() + Args3 USER_DEMOTE_ENDOFTRACK = (track, user, group) -> prefixed(translatable() // "&aThe end of track &b{}&a was reached, so &b{}&a was removed from &b{}&a." .key("luckperms.command.user.demote.end-of-track") .color(GREEN) - .args(text(track, AQUA), text(user, AQUA), text(group, AQUA)) + .args( + text(track, AQUA), + text().color(AQUA).append(user.getFormattedDisplayName()), + text(group, AQUA) + ) .append(FULL_STOP) ); - Args2 USER_DEMOTE_ENDOFTRACK_NOT_REMOVED = (track, user) -> prefixed(translatable() + Args2 USER_DEMOTE_ENDOFTRACK_NOT_REMOVED = (track, user) -> prefixed(translatable() // "&aThe end of track &b{}&a was reached, but &b{}&a was not removed from the first group." .key("luckperms.command.user.demote.end-of-track-not-removed") .color(GREEN) - .args(text(track, AQUA), text(user, AQUA)) + .args( + text(track, AQUA), + text().color(AQUA).append(user.getFormattedDisplayName()) + ) .append(FULL_STOP) ); @@ -3098,11 +3187,14 @@ public interface Message { })) ); - Args2 GROUP_SET_WEIGHT = (weight, group) -> prefixed(translatable() + Args2 GROUP_SET_WEIGHT = (weight, group) -> prefixed(translatable() // "&aSet weight to &b{}&a for group &b{}&a." .key("luckperms.command.group.setweight.set") .color(GREEN) - .args(text(weight, AQUA), text(group, AQUA)) + .args( + text(weight, AQUA), + text().color(AQUA).append(group.getFormattedDisplayName()) + ) .append(FULL_STOP) ); diff --git a/common/src/main/java/me/lucko/luckperms/common/model/Group.java b/common/src/main/java/me/lucko/luckperms/common/model/Group.java index 967894bbd..7f18071b2 100644 --- a/common/src/main/java/me/lucko/luckperms/common/model/Group.java +++ b/common/src/main/java/me/lucko/luckperms/common/model/Group.java @@ -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 diff --git a/common/src/main/java/me/lucko/luckperms/common/model/PermissionHolder.java b/common/src/main/java/me/lucko/luckperms/common/model/PermissionHolder.java index 67623b00d..61d642b9e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/model/PermissionHolder.java +++ b/common/src/main/java/me/lucko/luckperms/common/model/PermissionHolder.java @@ -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. diff --git a/common/src/main/java/me/lucko/luckperms/common/model/User.java b/common/src/main/java/me/lucko/luckperms/common/model/User.java index 772884379..24ce90573 100644 --- a/common/src/main/java/me/lucko/luckperms/common/model/User.java +++ b/common/src/main/java/me/lucko/luckperms/common/model/User.java @@ -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 diff --git a/common/src/main/java/me/lucko/luckperms/common/webeditor/WebEditorResponse.java b/common/src/main/java/me/lucko/luckperms/common/webeditor/WebEditorResponse.java index 38b80fc65..533a2781c 100644 --- a/common/src/main/java/me/lucko/luckperms/common/webeditor/WebEditorResponse.java +++ b/common/src/main/java/me/lucko/luckperms/common/webeditor/WebEditorResponse.java @@ -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")