diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultChatHook.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultChatHook.java index e14775ae..563b235e 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultChatHook.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultChatHook.java @@ -89,7 +89,7 @@ public class VaultChatHook extends AbstractVaultChat { MetaCache metaData = user.getCachedData().getMetaData(contexts); String ret = metaData.getPrefix(); if (log()) { - logMsg("#getUserChatPrefix: %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), ret); + logMsg("#getUserChatPrefix: %s - %s - %s", user.getPlainDisplayName(), contexts.getContexts().toMultimap(), ret); } return Strings.nullToEmpty(ret); } @@ -103,7 +103,7 @@ public class VaultChatHook extends AbstractVaultChat { MetaCache metaData = user.getCachedData().getMetaData(contexts); String ret = metaData.getSuffix(); if (log()) { - logMsg("#getUserChatSuffix: %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), ret); + logMsg("#getUserChatSuffix: %s - %s - %s", user.getPlainDisplayName(), contexts.getContexts().toMultimap(), ret); } return Strings.nullToEmpty(ret); } @@ -134,7 +134,7 @@ public class VaultChatHook extends AbstractVaultChat { MetaCache metaData = user.getCachedData().getMetaData(contexts); String ret = metaData.getMeta().get(key); if (log()) { - logMsg("#getUserMeta: %s - %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), key, ret); + logMsg("#getUserMeta: %s - %s - %s - %s", user.getPlainDisplayName(), contexts.getContexts().toMultimap(), key, ret); } return ret; } @@ -247,7 +247,7 @@ public class VaultChatHook extends AbstractVaultChat { private void setChatMeta(PermissionHolder holder, ChatMetaType type, String value, String world) { if (log()) { - logMsg("#setChatMeta: %s - %s - %s - %s", holder.getFriendlyName(), type, value, world); + logMsg("#setChatMeta: %s - %s - %s - %s", holder.getPlainDisplayName(), type, value, world); } // remove all prefixes/suffixes directly set on the user/group @@ -273,7 +273,7 @@ public class VaultChatHook extends AbstractVaultChat { private void setMeta(PermissionHolder holder, String key, Object value, String world) { if (log()) { - logMsg("#setMeta: %s - %s - %s - %s", holder.getFriendlyName(), key, value, world); + logMsg("#setMeta: %s - %s - %s - %s", holder.getPlainDisplayName(), key, value, world); } holder.removeIf(n -> n.isMeta() && n.getMeta().getKey().equals(key)); diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultPermissionHook.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultPermissionHook.java index a92ab54c..2de88993 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultPermissionHook.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/vault/VaultPermissionHook.java @@ -149,7 +149,7 @@ public class VaultPermissionHook extends AbstractVaultPermission { @Override public String[] getGroups() { return this.plugin.getGroupManager().getAll().values().stream() - .map(g -> g.getDisplayName().orElse(g.getName())) + .map(Group::getPlainDisplayName) .toArray(String[]::new); } @@ -164,7 +164,7 @@ public class VaultPermissionHook extends AbstractVaultPermission { Tristate result = permissionData.getPermissionValue(permission, CheckOrigin.INTERNAL); if (log()) { - logMsg("#userHasPermission: %s - %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), permission, result); + logMsg("#userHasPermission: %s - %s - %s - %s", user.getPlainDisplayName(), contexts.getContexts().toMultimap(), permission, result); } return result.asBoolean(); } @@ -221,14 +221,14 @@ public class VaultPermissionHook extends AbstractVaultPermission { .map(n -> { Group group = this.plugin.getGroupManager().getIfLoaded(n.getGroupName()); if (group != null) { - return group.getDisplayName().orElse(group.getName()); + return group.getPlainDisplayName(); } return n.getGroupName(); }) .toArray(String[]::new); if (log()) { - logMsg("#userGetGroups: %s - %s - %s", user.getFriendlyName(), contexts, Arrays.toString(ret)); + logMsg("#userGetGroups: %s - %s - %s", user.getPlainDisplayName(), contexts, Arrays.toString(ret)); } return ret; @@ -242,11 +242,11 @@ public class VaultPermissionHook extends AbstractVaultPermission { String value = user.getPrimaryGroup().getValue(); Group group = getGroup(value); if (group != null) { - value = group.getDisplayName().orElse(group.getName()); + value = group.getPlainDisplayName(); } if (log()) { - logMsg("#userGetPrimaryGroup: %s - %s - %s", user.getFriendlyName(), world, value); + logMsg("#userGetPrimaryGroup: %s - %s - %s", user.getPlainDisplayName(), world, value); } return value; @@ -370,7 +370,7 @@ public class VaultPermissionHook extends AbstractVaultPermission { Preconditions.checkArgument(!permission.isEmpty(), "permission is an empty string"); if (log()) { - logMsg("#holderAddPermission: %s - %s - %s", holder.getFriendlyName(), permission, world); + logMsg("#holderAddPermission: %s - %s - %s", holder.getPlainDisplayName(), permission, world); } if (holder.setPermission(NodeFactory.make(permission, true, getVaultServer(), world)).asBoolean()) { @@ -384,7 +384,7 @@ public class VaultPermissionHook extends AbstractVaultPermission { Preconditions.checkArgument(!permission.isEmpty(), "permission is an empty string"); if (log()) { - logMsg("#holderRemovePermission: %s - %s - %s", holder.getFriendlyName(), permission, world); + logMsg("#holderRemovePermission: %s - %s - %s", holder.getPlainDisplayName(), permission, world); } if (holder.unsetPermission(NodeFactory.make(permission, getVaultServer(), world)).asBoolean()) { diff --git a/common/src/main/java/me/lucko/luckperms/common/api/delegates/model/ApiPermissionHolder.java b/common/src/main/java/me/lucko/luckperms/common/api/delegates/model/ApiPermissionHolder.java index 0ae371a6..6aebabe2 100644 --- a/common/src/main/java/me/lucko/luckperms/common/api/delegates/model/ApiPermissionHolder.java +++ b/common/src/main/java/me/lucko/luckperms/common/api/delegates/model/ApiPermissionHolder.java @@ -85,11 +85,7 @@ public class ApiPermissionHolder implements me.lucko.luckperms.api.PermissionHol @Nonnull @Override public String getFriendlyName() { - if (this.handle.getType().isGroup()) { - Group group = (Group) this.handle; - return group.getDisplayName().orElse(group.getName()); - } - return this.handle.getFriendlyName(); + return this.handle.getPlainDisplayName(); } @Nonnull diff --git a/common/src/main/java/me/lucko/luckperms/common/caching/GroupCachedData.java b/common/src/main/java/me/lucko/luckperms/common/caching/GroupCachedData.java index 0e0099d6..b831c6f4 100644 --- a/common/src/main/java/me/lucko/luckperms/common/caching/GroupCachedData.java +++ b/common/src/main/java/me/lucko/luckperms/common/caching/GroupCachedData.java @@ -42,6 +42,6 @@ public class GroupCachedData extends HolderCachedData implements GroupDat @Override protected PermissionCalculatorMetadata getMetadataForContexts(Contexts contexts) { - return PermissionCalculatorMetadata.of(HolderType.GROUP, this.holder.getFriendlyName(), contexts.getContexts()); + return PermissionCalculatorMetadata.of(HolderType.GROUP, this.holder.getPlainDisplayName(), contexts.getContexts()); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/caching/UserCachedData.java b/common/src/main/java/me/lucko/luckperms/common/caching/UserCachedData.java index 52437af3..ba0dbd5f 100644 --- a/common/src/main/java/me/lucko/luckperms/common/caching/UserCachedData.java +++ b/common/src/main/java/me/lucko/luckperms/common/caching/UserCachedData.java @@ -42,6 +42,6 @@ public class UserCachedData extends HolderCachedData implements UserData { @Override protected PermissionCalculatorMetadata getMetadataForContexts(Contexts contexts) { - return PermissionCalculatorMetadata.of(HolderType.USER, this.holder.getFriendlyName(), contexts.getContexts()); + return PermissionCalculatorMetadata.of(HolderType.USER, this.holder.getPlainDisplayName(), contexts.getContexts()); } } 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 d2690bdf..294cafc5 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 @@ -104,7 +104,7 @@ public final class StorageAssistant { plugin.getStorage().saveUser(user).get(); } catch (Exception e) { e.printStackTrace(); - Message.USER_SAVE_ERROR.send(sender, user.getFriendlyName()); + Message.USER_SAVE_ERROR.send(sender, user.getFormattedDisplayName()); return; } @@ -126,7 +126,7 @@ public final class StorageAssistant { plugin.getStorage().saveGroup(group).get(); } catch (Exception e) { e.printStackTrace(); - Message.GROUP_SAVE_ERROR.send(sender, group.getFriendlyName()); + Message.GROUP_SAVE_ERROR.send(sender, group.getFormattedDisplayName()); 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 27e8c378..81ac2814 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 @@ -85,7 +85,7 @@ public class MetaAddChatMeta extends SharedSubCommand { DataMutateResult result = holder.setPermission(NodeFactory.buildChatMetaNode(this.type, priority, meta).withExtraContext(context).build()); if (result.asBoolean()) { - TextComponent.Builder builder = Message.ADD_CHATMETA_SUCCESS.asComponent(plugin.getLocaleManager(), holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)).toBuilder(); + TextComponent.Builder builder = Message.ADD_CHATMETA_SUCCESS.asComponent(plugin.getLocaleManager(), holder.getFormattedDisplayName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)).toBuilder(); HoverEvent event = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextUtils.fromLegacy( "¥3Raw " + this.type.name().toLowerCase() + ": ¥r" + meta, '¥' @@ -100,7 +100,7 @@ public class MetaAddChatMeta extends SharedSubCommand { StorageAssistant.save(holder, sender, plugin); return CommandResult.SUCCESS; } else { - Message.ALREADY_HAS_CHAT_META.send(sender, holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.ALREADY_HAS_CHAT_META.send(sender, holder.getFormattedDisplayName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), 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 7cae9109..fcc68491 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 @@ -93,7 +93,7 @@ public class MetaAddTempChatMeta extends SharedSubCommand { if (ret.getResult().asBoolean()) { duration = ret.getMergedNode().getExpiryUnixTime(); - TextComponent.Builder builder = Message.ADD_TEMP_CHATMETA_SUCCESS.asComponent(plugin.getLocaleManager(), holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, DurationFormatter.LONG.formatDateDiff(duration), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)).toBuilder(); + TextComponent.Builder builder = Message.ADD_TEMP_CHATMETA_SUCCESS.asComponent(plugin.getLocaleManager(), holder.getFormattedDisplayName(), this.type.name().toLowerCase(), meta, priority, DurationFormatter.LONG.formatDateDiff(duration), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)).toBuilder(); HoverEvent event = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextUtils.fromLegacy( "¥3Raw " + this.type.name().toLowerCase() + ": ¥r" + meta, '¥' @@ -108,7 +108,7 @@ public class MetaAddTempChatMeta extends SharedSubCommand { StorageAssistant.save(holder, sender, plugin); return CommandResult.SUCCESS; } else { - Message.ALREADY_HAS_TEMP_CHAT_META.send(sender, holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.ALREADY_HAS_TEMP_CHAT_META.send(sender, holder.getFormattedDisplayName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), 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 60da7e45..42ab77fc 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,9 +105,9 @@ public class MetaClear extends SharedSubCommand { int changed = before - holder.enduringData().immutable().size(); if (changed == 1) { - Message.META_CLEAR_SUCCESS_SINGULAR.send(sender, holder.getFriendlyName(), type.name().toLowerCase(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); + Message.META_CLEAR_SUCCESS_SINGULAR.send(sender, holder.getFormattedDisplayName(), type.name().toLowerCase(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); } else { - Message.META_CLEAR_SUCCESS.send(sender, holder.getFriendlyName(), type.name().toLowerCase(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); + Message.META_CLEAR_SUCCESS.send(sender, holder.getFormattedDisplayName(), type.name().toLowerCase(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); } ExtendedLogEntry.build().actor(sender).acted(holder) 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 8d7993b5..cca5a68c 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 @@ -96,23 +96,23 @@ public class MetaInfo extends SharedSubCommand { } if (prefixes.isEmpty()) { - Message.CHAT_META_PREFIX_NONE.send(sender, holder.getFriendlyName()); + Message.CHAT_META_PREFIX_NONE.send(sender, holder.getFormattedDisplayName()); } else { - Message.CHAT_META_PREFIX_HEADER.send(sender, holder.getFriendlyName()); + Message.CHAT_META_PREFIX_HEADER.send(sender, holder.getFormattedDisplayName()); sendChatMetaMessage(ChatMetaType.PREFIX, prefixes, sender, holder, label); } if (suffixes.isEmpty()) { - Message.CHAT_META_SUFFIX_NONE.send(sender, holder.getFriendlyName()); + Message.CHAT_META_SUFFIX_NONE.send(sender, holder.getFormattedDisplayName()); } else { - Message.CHAT_META_SUFFIX_HEADER.send(sender, holder.getFriendlyName()); + Message.CHAT_META_SUFFIX_HEADER.send(sender, holder.getFormattedDisplayName()); sendChatMetaMessage(ChatMetaType.SUFFIX, suffixes, sender, holder, label); } if (meta.isEmpty()) { - Message.META_NONE.send(sender, holder.getFriendlyName()); + Message.META_NONE.send(sender, holder.getFormattedDisplayName()); } else { - Message.META_HEADER.send(sender, holder.getFriendlyName()); + Message.META_HEADER.send(sender, holder.getFormattedDisplayName()); sendMetaMessage(meta, sender, holder, label); } @@ -163,10 +163,10 @@ public class MetaInfo extends SharedSubCommand { HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextUtils.fromLegacy(TextUtils.joinNewline( "¥3> ¥a" + type.getEntry(node).getKey() + " ¥7- ¥r" + type.getEntry(node).getValue(), " ", - "¥7Click to remove this " + type.name().toLowerCase() + " from " + holder.getFriendlyName() + "¥7Click to remove this " + type.name().toLowerCase() + " from " + holder.getFormattedDisplayName() ), '¥')); - String command = "/" + label + " " + NodeFactory.nodeAsCommand(node, holder.getType().isGroup() ? holder.getObjectName() : holder.getFriendlyName(), holder.getType(), false, !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty()); + String command = "/" + label + " " + NodeFactory.nodeAsCommand(node, holder.getType().isGroup() ? holder.getObjectName() : holder.getFormattedDisplayName(), holder.getType(), false, !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty()); ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command); return component -> { @@ -187,10 +187,10 @@ public class MetaInfo extends SharedSubCommand { HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextUtils.fromLegacy(TextUtils.joinNewline( "¥3> ¥r" + node.getMeta().getKey() + " ¥7- ¥r" + node.getMeta().getValue(), " ", - "¥7Click to remove this meta pair from " + holder.getFriendlyName() + "¥7Click to remove this meta pair from " + holder.getFormattedDisplayName() ), '¥')); - String command = "/" + label + " " + NodeFactory.nodeAsCommand(node, holder.getType().isGroup() ? holder.getObjectName() : holder.getFriendlyName(), holder.getType(), false, !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty()); + String command = "/" + label + " " + NodeFactory.nodeAsCommand(node, holder.getType().isGroup() ? holder.getObjectName() : holder.getFormattedDisplayName(), holder.getType(), false, !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty()); ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command); return component -> { 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 f0e3000f..1f26ea1a 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 @@ -91,7 +91,7 @@ public class MetaRemoveChatMeta extends SharedSubCommand { !n.isTemporary() && n.getFullContexts().makeImmutable().equals(context.makeImmutable()) ); - Message.BULK_REMOVE_CHATMETA_SUCCESS.send(sender, holder.getFriendlyName(), this.type.name().toLowerCase(), priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.BULK_REMOVE_CHATMETA_SUCCESS.send(sender, holder.getFormattedDisplayName(), this.type.name().toLowerCase(), priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); ExtendedLogEntry.build().actor(sender).acted(holder) .action("meta" , "remove" + this.type.name().toLowerCase(), priority, "*", context) @@ -104,7 +104,7 @@ public class MetaRemoveChatMeta extends SharedSubCommand { DataMutateResult result = holder.unsetPermission(NodeFactory.buildChatMetaNode(this.type, priority, meta).withExtraContext(context).build()); if (result.asBoolean()) { - TextComponent.Builder builder = Message.REMOVE_CHATMETA_SUCCESS.asComponent(plugin.getLocaleManager(), holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)).toBuilder(); + TextComponent.Builder builder = Message.REMOVE_CHATMETA_SUCCESS.asComponent(plugin.getLocaleManager(), holder.getFormattedDisplayName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)).toBuilder(); HoverEvent event = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextUtils.fromLegacy( "¥3Raw " + this.type.name().toLowerCase() + ": ¥r" + meta, '¥' @@ -119,7 +119,7 @@ public class MetaRemoveChatMeta extends SharedSubCommand { StorageAssistant.save(holder, sender, plugin); return CommandResult.SUCCESS; } else { - Message.DOES_NOT_HAVE_CHAT_META.send(sender, holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.DOES_NOT_HAVE_CHAT_META.send(sender, holder.getFormattedDisplayName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), 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 cc7fcb4b..af84db24 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 @@ -91,7 +91,7 @@ public class MetaRemoveTempChatMeta extends SharedSubCommand { !n.isPermanent() && n.getFullContexts().makeImmutable().equals(context.makeImmutable()) ); - Message.BULK_REMOVE_TEMP_CHATMETA_SUCCESS.send(sender, holder.getFriendlyName(), this.type.name().toLowerCase(), priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.BULK_REMOVE_TEMP_CHATMETA_SUCCESS.send(sender, holder.getFormattedDisplayName(), this.type.name().toLowerCase(), priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); ExtendedLogEntry.build().actor(sender).acted(holder) .action("meta" , "removetemp" + this.type.name().toLowerCase(), priority, "*", context) @@ -104,7 +104,7 @@ public class MetaRemoveTempChatMeta extends SharedSubCommand { DataMutateResult result = holder.unsetPermission(NodeFactory.buildChatMetaNode(this.type, priority, meta).setExpiry(10L).withExtraContext(context).build()); if (result.asBoolean()) { - TextComponent.Builder builder = Message.REMOVE_TEMP_CHATMETA_SUCCESS.asComponent(plugin.getLocaleManager(), holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)).toBuilder(); + TextComponent.Builder builder = Message.REMOVE_TEMP_CHATMETA_SUCCESS.asComponent(plugin.getLocaleManager(), holder.getFormattedDisplayName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)).toBuilder(); HoverEvent event = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextUtils.fromLegacy( "¥3Raw " + this.type.name().toLowerCase() + ": ¥r" + meta, '¥' @@ -119,7 +119,7 @@ public class MetaRemoveTempChatMeta extends SharedSubCommand { StorageAssistant.save(holder, sender, plugin); return CommandResult.SUCCESS; } else { - Message.DOES_NOT_HAVE_TEMP_CHAT_META.send(sender, holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.DOES_NOT_HAVE_TEMP_CHAT_META.send(sender, holder.getFormattedDisplayName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), 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 03fa079d..ff62ef11 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 @@ -79,14 +79,14 @@ public class MetaSet extends SharedSubCommand { Node n = NodeFactory.buildMetaNode(key, value).withExtraContext(context).build(); if (holder.hasPermission(NodeMapType.ENDURING, n, StandardNodeEquality.IGNORE_EXPIRY_TIME_AND_VALUE).asBoolean()) { - Message.ALREADY_HAS_META.send(sender, holder.getFriendlyName(), key, value, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.ALREADY_HAS_META.send(sender, holder.getFormattedDisplayName(), key, value, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); return CommandResult.STATE_ERROR; } holder.clearMetaKeys(key, context, false); holder.setPermission(n); - TextComponent.Builder builder = Message.SET_META_SUCCESS.asComponent(plugin.getLocaleManager(), key, value, holder.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)).toBuilder(); + TextComponent.Builder builder = Message.SET_META_SUCCESS.asComponent(plugin.getLocaleManager(), key, value, holder.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)).toBuilder(); HoverEvent event = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextUtils.fromLegacy( TextUtils.joinNewline("¥3Raw key: ¥r" + key, "¥3Raw value: ¥r" + value), '¥' 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 e958a70d..e8881e81 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 @@ -121,7 +121,7 @@ public class MetaSetChatMeta extends SharedSubCommand { DataMutateResult result = holder.setPermission(NodeFactory.buildChatMetaNode(this.type, priority, meta).withExtraContext(context).build()); if (result.asBoolean()) { - TextComponent.Builder builder = Message.ADD_CHATMETA_SUCCESS.asComponent(plugin.getLocaleManager(), holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)).toBuilder(); + TextComponent.Builder builder = Message.ADD_CHATMETA_SUCCESS.asComponent(plugin.getLocaleManager(), holder.getFormattedDisplayName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)).toBuilder(); HoverEvent event = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextUtils.fromLegacy( "¥3Raw " + this.type.name().toLowerCase() + ": ¥r" + meta, '¥' @@ -136,7 +136,7 @@ public class MetaSetChatMeta extends SharedSubCommand { StorageAssistant.save(holder, sender, plugin); return CommandResult.SUCCESS; } else { - Message.ALREADY_HAS_CHAT_META.send(sender, holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.ALREADY_HAS_CHAT_META.send(sender, holder.getFormattedDisplayName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), 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 81c78e47..1f803f69 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 @@ -84,14 +84,14 @@ public class MetaSetTemp extends SharedSubCommand { Node n = NodeFactory.buildMetaNode(key, value).withExtraContext(context).setExpiry(duration).build(); if (holder.hasPermission(NodeMapType.ENDURING, n, StandardNodeEquality.IGNORE_EXPIRY_TIME_AND_VALUE).asBoolean()) { - Message.ALREADY_HAS_TEMP_META.send(sender, holder.getFriendlyName(), key, value, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.ALREADY_HAS_TEMP_META.send(sender, holder.getFormattedDisplayName(), key, value, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); return CommandResult.STATE_ERROR; } holder.clearMetaKeys(key, context, true); duration = holder.setPermission(n, modifier).getMergedNode().getExpiryUnixTime(); - TextComponent.Builder builder = Message.SET_META_TEMP_SUCCESS.asComponent(plugin.getLocaleManager(), key, value, holder.getFriendlyName(), DurationFormatter.LONG.formatDateDiff(duration), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)).toBuilder(); + TextComponent.Builder builder = Message.SET_META_TEMP_SUCCESS.asComponent(plugin.getLocaleManager(), key, value, holder.getFormattedDisplayName(), DurationFormatter.LONG.formatDateDiff(duration), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)).toBuilder(); HoverEvent event = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextUtils.fromLegacy( TextUtils.joinNewline("¥3Raw key: ¥r" + key, "¥3Raw value: ¥r" + value), '¥' 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 d7f53382..d6609e0f 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 @@ -133,7 +133,7 @@ public class MetaSetTempChatMeta extends SharedSubCommand { if (ret.getResult().asBoolean()) { duration = ret.getMergedNode().getExpiryUnixTime(); - TextComponent.Builder builder = Message.ADD_TEMP_CHATMETA_SUCCESS.asComponent(plugin.getLocaleManager(), holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, DurationFormatter.LONG.formatDateDiff(duration), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)).toBuilder(); + TextComponent.Builder builder = Message.ADD_TEMP_CHATMETA_SUCCESS.asComponent(plugin.getLocaleManager(), holder.getFormattedDisplayName(), this.type.name().toLowerCase(), meta, priority, DurationFormatter.LONG.formatDateDiff(duration), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)).toBuilder(); HoverEvent event = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextUtils.fromLegacy( "¥3Raw " + this.type.name().toLowerCase() + ": ¥r" + meta, '¥' @@ -148,7 +148,7 @@ public class MetaSetTempChatMeta extends SharedSubCommand { StorageAssistant.save(holder, sender, plugin); return CommandResult.SUCCESS; } else { - Message.ALREADY_HAS_TEMP_CHAT_META.send(sender, holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.ALREADY_HAS_TEMP_CHAT_META.send(sender, holder.getFormattedDisplayName(), this.type.name().toLowerCase(), meta, priority, MessageUtils.contextSetToString(plugin.getLocaleManager(), 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 f07cd431..10b093c7 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 @@ -68,7 +68,7 @@ public class MetaUnset extends SharedSubCommand { } if (holder.clearMetaKeys(key, context, false)) { - Message.UNSET_META_SUCCESS.send(sender, key, holder.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.UNSET_META_SUCCESS.send(sender, key, holder.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); ExtendedLogEntry.build().actor(sender).acted(holder) .action("meta", "unset", key, context) @@ -77,7 +77,7 @@ public class MetaUnset extends SharedSubCommand { StorageAssistant.save(holder, sender, plugin); return CommandResult.SUCCESS; } else { - Message.DOESNT_HAVE_META.send(sender, holder.getFriendlyName(), key, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.DOESNT_HAVE_META.send(sender, holder.getFormattedDisplayName(), key, MessageUtils.contextSetToString(plugin.getLocaleManager(), 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 6db1c99d..97e77690 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 @@ -68,7 +68,7 @@ public class MetaUnsetTemp extends SharedSubCommand { } if (holder.clearMetaKeys(key, context, true)) { - Message.UNSET_META_TEMP_SUCCESS.send(sender, key, holder.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.UNSET_META_TEMP_SUCCESS.send(sender, key, holder.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); ExtendedLogEntry.build().actor(sender).acted(holder) .action("meta", "unsettemp", key, context) @@ -77,7 +77,7 @@ public class MetaUnsetTemp extends SharedSubCommand { StorageAssistant.save(holder, sender, plugin); return CommandResult.SUCCESS; } else { - Message.DOESNT_HAVE_TEMP_META.send(sender, holder.getFriendlyName(), key, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.DOESNT_HAVE_TEMP_META.send(sender, holder.getFormattedDisplayName(), key, MessageUtils.contextSetToString(plugin.getLocaleManager(), 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 a4cb6357..1ae7c5cf 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 @@ -75,9 +75,9 @@ public class HolderClear extends SubCommand { int changed = before - holder.enduringData().immutable().size(); if (changed == 1) { - Message.CLEAR_SUCCESS_SINGULAR.send(sender, holder.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); + Message.CLEAR_SUCCESS_SINGULAR.send(sender, holder.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); } else { - Message.CLEAR_SUCCESS.send(sender, holder.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); + Message.CLEAR_SUCCESS.send(sender, holder.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); } ExtendedLogEntry.build().actor(sender).acted(holder) 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 4a9410ea..fb60b735 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 @@ -102,11 +102,11 @@ public class HolderShowTracks extends SubCommand } if (lines.isEmpty()) { - Message.LIST_TRACKS_EMPTY.send(sender, holder.getFriendlyName()); + Message.LIST_TRACKS_EMPTY.send(sender, holder.getFormattedDisplayName()); return CommandResult.SUCCESS; } - Message.LIST_TRACKS.send(sender, holder.getFriendlyName()); + Message.LIST_TRACKS.send(sender, holder.getFormattedDisplayName()); for (Map.Entry 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 0cceb876..8ee62633 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 @@ -81,7 +81,7 @@ public class ParentAdd extends SharedSubCommand { DataMutateResult result = holder.setPermission(NodeFactory.buildGroupNode(group.getName()).withExtraContext(context).build()); if (result.asBoolean()) { - Message.SET_INHERIT_SUCCESS.send(sender, holder.getFriendlyName(), group.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.SET_INHERIT_SUCCESS.send(sender, holder.getFormattedDisplayName(), group.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); ExtendedLogEntry.build().actor(sender).acted(holder) .action("parent", "add", group.getName(), context) @@ -90,7 +90,7 @@ public class ParentAdd extends SharedSubCommand { StorageAssistant.save(holder, sender, plugin); return CommandResult.SUCCESS; } else { - Message.ALREADY_INHERITS.send(sender, holder.getFriendlyName(), group.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.ALREADY_INHERITS.send(sender, holder.getFormattedDisplayName(), group.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), 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 7b14e6fc..d9358de2 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 @@ -84,7 +84,7 @@ public class ParentAddTemp extends SharedSubCommand { } if (group.getName().equalsIgnoreCase(holder.getObjectName())) { - Message.ALREADY_TEMP_INHERITS.send(sender, holder.getFriendlyName(), group.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.ALREADY_TEMP_INHERITS.send(sender, holder.getFormattedDisplayName(), group.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); return CommandResult.STATE_ERROR; } @@ -92,7 +92,7 @@ public class ParentAddTemp extends SharedSubCommand { if (ret.getResult().asBoolean()) { duration = ret.getMergedNode().getExpiryUnixTime(); - Message.SET_TEMP_INHERIT_SUCCESS.send(sender, holder.getFriendlyName(), group.getFriendlyName(), DurationFormatter.LONG.formatDateDiff(duration), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.SET_TEMP_INHERIT_SUCCESS.send(sender, holder.getFormattedDisplayName(), group.getFormattedDisplayName(), DurationFormatter.LONG.formatDateDiff(duration), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); ExtendedLogEntry.build().actor(sender).acted(holder) .action("parent", "addtemp", group.getName(), duration, context) @@ -101,7 +101,7 @@ public class ParentAddTemp extends SharedSubCommand { StorageAssistant.save(holder, sender, plugin); return CommandResult.SUCCESS; } else { - Message.ALREADY_TEMP_INHERITS.send(sender, holder.getFriendlyName(), group.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.ALREADY_TEMP_INHERITS.send(sender, holder.getFormattedDisplayName(), group.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), 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 9ce6a07b..ae09b601 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 @@ -74,9 +74,9 @@ public class ParentClear extends SharedSubCommand { int changed = before - holder.enduringData().immutable().size(); if (changed == 1) { - Message.PARENT_CLEAR_SUCCESS_SINGULAR.send(sender, holder.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); + Message.PARENT_CLEAR_SUCCESS_SINGULAR.send(sender, holder.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); } else { - Message.PARENT_CLEAR_SUCCESS.send(sender, holder.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); + Message.PARENT_CLEAR_SUCCESS.send(sender, holder.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); } ExtendedLogEntry.build().actor(sender).acted(holder) 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 f007d174..ab6f2ad1 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 @@ -102,9 +102,9 @@ public class ParentClearTrack extends SharedSubCommand { int changed = before - holder.enduringData().immutable().size(); if (changed == 1) { - Message.PARENT_CLEAR_TRACK_SUCCESS_SINGULAR.send(sender, holder.getFriendlyName(), track.getName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); + Message.PARENT_CLEAR_TRACK_SUCCESS_SINGULAR.send(sender, holder.getFormattedDisplayName(), track.getName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); } else { - Message.PARENT_CLEAR_TRACK_SUCCESS.send(sender, holder.getFriendlyName(), track.getName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); + Message.PARENT_CLEAR_TRACK_SUCCESS.send(sender, holder.getFormattedDisplayName(), track.getName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); } ExtendedLogEntry.build().actor(sender).acted(holder) 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 4bda2403..d5f43513 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 @@ -83,7 +83,7 @@ public class ParentInfo extends SharedSubCommand { // handle empty if (nodes.isEmpty()) { - Message.PARENT_INFO_NO_DATA.send(sender, holder.getFriendlyName()); + Message.PARENT_INFO_NO_DATA.send(sender, holder.getFormattedDisplayName()); return CommandResult.SUCCESS; } @@ -108,7 +108,7 @@ public class ParentInfo extends SharedSubCommand { List content = pages.get(pageIndex); // send header - Message.PARENT_INFO.send(sender, holder.getFriendlyName(), page, pages.size(), nodes.size()); + Message.PARENT_INFO.send(sender, holder.getFormattedDisplayName(), page, pages.size(), nodes.size()); // send content for (LocalizedNode node : content) { @@ -138,10 +138,10 @@ public class ParentInfo extends SharedSubCommand { HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextUtils.fromLegacy(TextUtils.joinNewline( "&3> &f" + node.getGroupName(), " ", - "&7Click to remove this parent from " + holder.getFriendlyName() + "&7Click to remove this parent from " + holder.getFormattedDisplayName() ), CommandManager.AMPERSAND_CHAR)); - String command = "/" + label + " " + NodeFactory.nodeAsCommand(node, holder.getType().isGroup() ? holder.getObjectName() : holder.getFriendlyName(), holder.getType(), false, !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty()); + String command = "/" + label + " " + NodeFactory.nodeAsCommand(node, holder.getType().isGroup() ? holder.getObjectName() : holder.getFormattedDisplayName(), holder.getType(), false, !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty()); ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command); return component -> { 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 9b4ee4ee..05c73197 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 @@ -90,7 +90,7 @@ public class ParentRemove extends SharedSubCommand { DataMutateResult result = holder.unsetPermission(NodeFactory.buildGroupNode(groupName).withExtraContext(context).build()); if (result.asBoolean()) { - Message.UNSET_INHERIT_SUCCESS.send(sender, holder.getFriendlyName(), groupName, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.UNSET_INHERIT_SUCCESS.send(sender, holder.getFormattedDisplayName(), groupName, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); ExtendedLogEntry.build().actor(sender).acted(holder) .action("parent", "remove", groupName, context) @@ -103,7 +103,7 @@ public class ParentRemove extends SharedSubCommand { StorageAssistant.save(holder, sender, plugin); return CommandResult.SUCCESS; } else { - Message.DOES_NOT_INHERIT.send(sender, holder.getFriendlyName(), groupName, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.DOES_NOT_INHERIT.send(sender, holder.getFormattedDisplayName(), groupName, MessageUtils.contextSetToString(plugin.getLocaleManager(), 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 7e6defc6..2f16c0e9 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 @@ -75,7 +75,7 @@ public class ParentRemoveTemp extends SharedSubCommand { DataMutateResult result = holder.unsetPermission(NodeFactory.buildGroupNode(groupName).setExpiry(10L).withExtraContext(context).build()); if (result.asBoolean()) { - Message.UNSET_TEMP_INHERIT_SUCCESS.send(sender, holder.getFriendlyName(), groupName, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.UNSET_TEMP_INHERIT_SUCCESS.send(sender, holder.getFormattedDisplayName(), groupName, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); ExtendedLogEntry.build().actor(sender).acted(holder) .action("parent", "removetemp", groupName, context) @@ -84,7 +84,7 @@ public class ParentRemoveTemp extends SharedSubCommand { StorageAssistant.save(holder, sender, plugin); return CommandResult.SUCCESS; } else { - Message.DOES_NOT_TEMP_INHERIT.send(sender, holder.getFriendlyName(), groupName, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.DOES_NOT_TEMP_INHERIT.send(sender, holder.getFormattedDisplayName(), groupName, MessageUtils.contextSetToString(plugin.getLocaleManager(), 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 faabf34f..ad55192d 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 @@ -84,7 +84,7 @@ public class ParentSet extends SharedSubCommand { ((User) holder).getPrimaryGroup().setStoredValue(group.getName()); } - Message.SET_PARENT_SUCCESS.send(sender, holder.getFriendlyName(), group.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.SET_PARENT_SUCCESS.send(sender, holder.getFormattedDisplayName(), group.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); ExtendedLogEntry.build().actor(sender).acted(holder) .action("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 c79a23a4..b636deab 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 @@ -114,7 +114,7 @@ public class ParentSetTrack extends SharedSubCommand { holder.removeIf(node -> node.isGroupNode() && node.getFullContexts().equals(context) && track.containsGroup(node.getGroupName())); holder.setPermission(NodeFactory.buildGroupNode(group.getName()).withExtraContext(context).build()); - Message.SET_TRACK_PARENT_SUCCESS.send(sender, holder.getFriendlyName(), track.getName(), group.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.SET_TRACK_PARENT_SUCCESS.send(sender, holder.getFormattedDisplayName(), track.getName(), group.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); ExtendedLogEntry.build().actor(sender).acted(holder) .action("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 22bf21e6..aeb2d9a2 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 @@ -88,18 +88,18 @@ public class UserSwitchPrimaryGroup extends SharedSubCommand { } if (user.getPrimaryGroup().getStoredValue().orElse(NodeFactory.DEFAULT_GROUP_NAME).equalsIgnoreCase(group.getName())) { - Message.USER_PRIMARYGROUP_ERROR_ALREADYHAS.send(sender, user.getFriendlyName(), group.getFriendlyName()); + Message.USER_PRIMARYGROUP_ERROR_ALREADYHAS.send(sender, user.getFormattedDisplayName(), group.getFormattedDisplayName()); return CommandResult.STATE_ERROR; } Node node = NodeFactory.buildGroupNode(group.getName()).build(); if (!user.hasPermission(NodeMapType.ENDURING, node, StandardNodeEquality.IGNORE_VALUE).asBoolean()) { - Message.USER_PRIMARYGROUP_ERROR_NOTMEMBER.send(sender, user.getFriendlyName(), group.getName()); + Message.USER_PRIMARYGROUP_ERROR_NOTMEMBER.send(sender, user.getFormattedDisplayName(), group.getName()); user.setPermission(node); } user.getPrimaryGroup().setStoredValue(group.getName()); - Message.USER_PRIMARYGROUP_SUCCESS.send(sender, user.getFriendlyName(), group.getFriendlyName()); + Message.USER_PRIMARYGROUP_SUCCESS.send(sender, user.getFormattedDisplayName(), group.getFormattedDisplayName()); ExtendedLogEntry.build().actor(sender).acted(user) .action("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 60233364..60eaf29d 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 @@ -67,7 +67,7 @@ public class PermissionCheck extends SharedSubCommand { Tristate result = holder.hasPermission(NodeMapType.ENDURING, NodeFactory.builder(node).withExtraContext(context).build(), StandardNodeEquality.IGNORE_VALUE_OR_IF_TEMPORARY); String s = MessageUtils.formatTristate(result); - Message.CHECK_PERMISSION.send(sender, holder.getFriendlyName(), node, s, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.CHECK_PERMISSION.send(sender, holder.getFormattedDisplayName(), node, s, MessageUtils.contextSetToString(plugin.getLocaleManager(), 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 b8e1bdea..0fec24c3 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 @@ -71,7 +71,7 @@ public class PermissionCheckInherits extends SharedSubCommand { } String s = MessageUtils.formatTristate(result.getResult()); - Message.CHECK_INHERITS_PERMISSION.send(sender, holder.getFriendlyName(), node, s, MessageUtils.contextSetToString(plugin.getLocaleManager(), context), String.valueOf(location)); + Message.CHECK_INHERITS_PERMISSION.send(sender, holder.getFormattedDisplayName(), node, s, MessageUtils.contextSetToString(plugin.getLocaleManager(), context), String.valueOf(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 2d4bfd58..40244e20 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 @@ -75,9 +75,9 @@ public class PermissionClear extends SharedSubCommand { int changed = before - holder.enduringData().immutable().size(); if (changed == 1) { - Message.PERMISSION_CLEAR_SUCCESS_SINGULAR.send(sender, holder.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); + Message.PERMISSION_CLEAR_SUCCESS_SINGULAR.send(sender, holder.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); } else { - Message.PERMISSION_CLEAR_SUCCESS.send(sender, holder.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); + Message.PERMISSION_CLEAR_SUCCESS.send(sender, holder.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context), changed); } ExtendedLogEntry.build().actor(sender).acted(holder) 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 4efa2a28..b18234e6 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 @@ -85,7 +85,7 @@ public class PermissionInfo extends SharedSubCommand { // handle empty if (nodes.isEmpty()) { - Message.PERMISSION_INFO_NO_DATA.send(sender, holder.getFriendlyName()); + Message.PERMISSION_INFO_NO_DATA.send(sender, holder.getFormattedDisplayName()); return CommandResult.SUCCESS; } @@ -110,7 +110,7 @@ public class PermissionInfo extends SharedSubCommand { List content = pages.get(pageIndex); // send header - Message.PERMISSION_INFO.send(sender, holder.getFriendlyName(), page, pages.size(), nodes.size()); + Message.PERMISSION_INFO.send(sender, holder.getFormattedDisplayName(), page, pages.size(), nodes.size()); // send content for (LocalizedNode node : content) { @@ -140,10 +140,10 @@ public class PermissionInfo extends SharedSubCommand { HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextUtils.fromLegacy(TextUtils.joinNewline( "¥3> " + (node.getValue() ? "¥a" : "¥c") + node.getPermission(), " ", - "¥7Click to remove this node from " + holder.getFriendlyName() + "¥7Click to remove this node from " + holder.getFormattedDisplayName() ), '¥')); - String command = "/" + label + " " + NodeFactory.nodeAsCommand(node, holder.getType().isGroup() ? holder.getObjectName() : holder.getFriendlyName(), holder.getType(), false, !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty()); + String command = "/" + label + " " + NodeFactory.nodeAsCommand(node, holder.getType().isGroup() ? holder.getObjectName() : holder.getFormattedDisplayName(), holder.getType(), false, !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty()); ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command); return component -> { 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 0052712b..2523f66e 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 @@ -85,7 +85,7 @@ public class PermissionSet extends SharedSubCommand { DataMutateResult result = holder.setPermission(NodeFactory.builder(node).setValue(value).withExtraContext(context).build()); if (result.asBoolean()) { - Message.SETPERMISSION_SUCCESS.send(sender, node, value, holder.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.SETPERMISSION_SUCCESS.send(sender, node, value, holder.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); ExtendedLogEntry.build().actor(sender).acted(holder) .action("permission", "set", node, value, context) @@ -94,7 +94,7 @@ public class PermissionSet extends SharedSubCommand { StorageAssistant.save(holder, sender, plugin); return CommandResult.SUCCESS; } else { - Message.ALREADY_HASPERMISSION.send(sender, holder.getFriendlyName(), node, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.ALREADY_HASPERMISSION.send(sender, holder.getFormattedDisplayName(), node, MessageUtils.contextSetToString(plugin.getLocaleManager(), 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 de9f4f96..8d320167 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 @@ -91,7 +91,7 @@ public class PermissionSetTemp extends SharedSubCommand { if (result.getResult().asBoolean()) { duration = result.getMergedNode().getExpiryUnixTime(); - Message.SETPERMISSION_TEMP_SUCCESS.send(sender, node, value, holder.getFriendlyName(), DurationFormatter.LONG.formatDateDiff(duration), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.SETPERMISSION_TEMP_SUCCESS.send(sender, node, value, holder.getFormattedDisplayName(), DurationFormatter.LONG.formatDateDiff(duration), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); ExtendedLogEntry.build().actor(sender).acted(holder) .action("permission", "settemp", node, value, duration, context) @@ -100,7 +100,7 @@ public class PermissionSetTemp extends SharedSubCommand { StorageAssistant.save(holder, sender, plugin); return CommandResult.SUCCESS; } else { - Message.ALREADY_HAS_TEMP_PERMISSION.send(sender, holder.getFriendlyName(), node, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.ALREADY_HAS_TEMP_PERMISSION.send(sender, holder.getFormattedDisplayName(), node, MessageUtils.contextSetToString(plugin.getLocaleManager(), 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 7874f443..04d8c888 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 @@ -84,7 +84,7 @@ public class PermissionUnset extends SharedSubCommand { DataMutateResult result = holder.unsetPermission(NodeFactory.builder(node).withExtraContext(context).build()); if (result.asBoolean()) { - Message.UNSETPERMISSION_SUCCESS.send(sender, node, holder.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.UNSETPERMISSION_SUCCESS.send(sender, node, holder.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); ExtendedLogEntry.build().actor(sender).acted(holder) .action("permission", "unset", node, context) @@ -93,7 +93,7 @@ public class PermissionUnset extends SharedSubCommand { StorageAssistant.save(holder, sender, plugin); return CommandResult.SUCCESS; } else { - Message.DOES_NOT_HAVE_PERMISSION.send(sender, holder.getFriendlyName(), node, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.DOES_NOT_HAVE_PERMISSION.send(sender, holder.getFormattedDisplayName(), node, MessageUtils.contextSetToString(plugin.getLocaleManager(), 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 4da77c7a..82014081 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 @@ -84,7 +84,7 @@ public class PermissionUnsetTemp extends SharedSubCommand { DataMutateResult result = holder.unsetPermission(NodeFactory.builder(node).setExpiry(10L).withExtraContext(context).build()); if (result.asBoolean()) { - Message.UNSET_TEMP_PERMISSION_SUCCESS.send(sender, node, holder.getFriendlyName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.UNSET_TEMP_PERMISSION_SUCCESS.send(sender, node, holder.getFormattedDisplayName(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); ExtendedLogEntry.build().actor(sender).acted(holder) .action("permission", "unsettemp", node, context) @@ -93,7 +93,7 @@ public class PermissionUnsetTemp extends SharedSubCommand { StorageAssistant.save(holder, sender, plugin); return CommandResult.SUCCESS; } else { - Message.DOES_NOT_HAVE_TEMP_PERMISSION.send(sender, holder.getFriendlyName(), node, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.DOES_NOT_HAVE_TEMP_PERMISSION.send(sender, holder.getFormattedDisplayName(), node, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); return CommandResult.STATE_ERROR; } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/DeleteGroup.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/DeleteGroup.java index bd12c865..59ebce7f 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/DeleteGroup.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/DeleteGroup.java @@ -73,11 +73,11 @@ public class DeleteGroup extends SingleCommand { plugin.getStorage().deleteGroup(group, DeletionCause.COMMAND).get(); } catch (Exception e) { e.printStackTrace(); - Message.DELETE_ERROR.send(sender, group.getFriendlyName()); + Message.DELETE_ERROR.send(sender, group.getFormattedDisplayName()); return CommandResult.FAILURE; } - Message.DELETE_SUCCESS.send(sender, group.getFriendlyName()); + Message.DELETE_SUCCESS.send(sender, group.getFormattedDisplayName()); ExtendedLogEntry.build().actor(sender).actedName(groupName).type(LogEntry.Type.GROUP) .action("delete") diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupInfo.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupInfo.java index 426a76eb..cb6b4ce3 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupInfo.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupInfo.java @@ -58,7 +58,7 @@ public class GroupInfo extends SubCommand { Message.GROUP_INFO_GENERAL.send(sender, group.getName(), - group.getDisplayName().orElse(group.getName()), + group.getPlainDisplayName(), group.getWeight().isPresent() ? group.getWeight().getAsInt() : "None" ); 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 67512371..fea77ba3 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 @@ -75,7 +75,7 @@ public class GroupRename extends SubCommand { plugin.getStorage().deleteGroup(group, DeletionCause.COMMAND).get(); } catch (Exception e) { e.printStackTrace(); - Message.DELETE_ERROR.send(sender, group.getFriendlyName()); + Message.DELETE_ERROR.send(sender, group.getFormattedDisplayName()); return CommandResult.FAILURE; } 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 5203bac3..eef0cb98 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 @@ -62,7 +62,7 @@ public class GroupSetWeight extends SubCommand { group.removeIf(n -> n.getTypeData(WeightType.KEY).isPresent()); group.setPermission(NodeFactory.buildWeightNode(weight).build()); - Message.GROUP_SET_WEIGHT.send(sender, weight, group.getFriendlyName()); + Message.GROUP_SET_WEIGHT.send(sender, weight, group.getFormattedDisplayName()); ExtendedLogEntry.build().actor(sender).acted(group) .action("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 1a22639e..88e45c5b 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 @@ -73,12 +73,12 @@ public class ListGroups extends SingleCommand { if (tracks.isEmpty()) { component = Message.GROUPS_LIST_ENTRY.asComponent(plugin.getLocaleManager(), - group.getFriendlyName(), + group.getFormattedDisplayName(), group.getWeight().orElse(0) ); } else { component = Message.GROUPS_LIST_ENTRY_WITH_TRACKS.asComponent(plugin.getLocaleManager(), - group.getFriendlyName(), + group.getFormattedDisplayName(), group.getWeight().orElse(0), MessageUtils.toCommaSep(tracks) ); diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/ApplyEditsCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/ApplyEditsCommand.java index 3f40bfb7..69e99c93 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/ApplyEditsCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/ApplyEditsCommand.java @@ -146,7 +146,7 @@ public class ApplyEditsCommand extends SingleCommand { String additionsSummary = "addition" + (additions == 1 ? "" : "s"); String deletionsSummary = "deletion" + (deletions == 1 ? "" : "s"); - Message.APPLY_EDITS_SUCCESS.send(sender, holder.getFriendlyName()); + Message.APPLY_EDITS_SUCCESS.send(sender, holder.getFormattedDisplayName()); Message.APPLY_EDITS_SUCCESS_SUMMARY.send(sender, additions, additionsSummary, deletions, deletionsSummary); for (Node n : diffAdded) { Message.APPLY_EDITS_DIFF_ADDED.send(sender, formatNode(plugin.getLocaleManager(), n)); 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 450ebd1e..9cf58c71 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 @@ -71,7 +71,7 @@ public class CheckCommand extends SingleCommand { } Tristate tristate = user.getCachedData().getPermissionData(plugin.getContextForUser(user).orElse(plugin.getContextManager().getStaticContexts())).getPermissionValue(permission, CheckOrigin.INTERNAL); - Message.CHECK_RESULT.send(sender, user.getFriendlyName(), permission, MessageUtils.formatTristate(tristate)); + Message.CHECK_RESULT.send(sender, user.getFormattedDisplayName(), permission, MessageUtils.formatTristate(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 cba61776..e05decff 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 @@ -83,7 +83,7 @@ public class EditorCommand extends SingleCommand { } if (type.includingUsers) { plugin.getUserManager().getAll().values().stream() - .sorted((o1, o2) -> o1.getFriendlyName().compareToIgnoreCase(o2.getFriendlyName())) + .sorted((o1, o2) -> o1.getFormattedDisplayName().compareToIgnoreCase(o2.getFormattedDisplayName())) .forEach(holders::add); } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserClone.java b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserClone.java index 6737f8c1..d7613cb5 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserClone.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserClone.java @@ -74,7 +74,7 @@ public class UserClone extends SubCommand { otherUser.replaceNodes(NodeMapType.ENDURING, user.enduringData().immutable()); - Message.CLONE_SUCCESS.send(sender, user.getFriendlyName(), otherUser.getFriendlyName()); + Message.CLONE_SUCCESS.send(sender, user.getFormattedDisplayName(), otherUser.getFormattedDisplayName()); ExtendedLogEntry.build().actor(sender).acted(otherUser) .action("clone", user.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 bba4ec11..67184f5b 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 @@ -96,10 +96,10 @@ public class UserDemote extends SubCommand { DemotionResult result = track.demote(user, context, previousGroupPermissionChecker, sender, removeFromFirst); switch (result.getStatus()) { case NOT_ON_TRACK: - Message.USER_TRACK_ERROR_NOT_CONTAIN_GROUP.send(sender, user.getFriendlyName(), track.getName()); + Message.USER_TRACK_ERROR_NOT_CONTAIN_GROUP.send(sender, user.getFormattedDisplayName(), track.getName()); return CommandResult.FAILURE; case AMBIGUOUS_CALL: - Message.TRACK_AMBIGUOUS_CALL.send(sender, user.getFriendlyName()); + Message.TRACK_AMBIGUOUS_CALL.send(sender, user.getFormattedDisplayName()); return CommandResult.FAILURE; case UNDEFINED_FAILURE: Message.COMMAND_NO_PERMISSION.send(sender); @@ -110,11 +110,11 @@ public class UserDemote extends SubCommand { case REMOVED_FROM_FIRST_GROUP: { if (!removeFromFirst && !result.getGroupFrom().isPresent()) { - Message.USER_DEMOTE_ENDOFTRACK_NOT_REMOVED.send(sender, track.getName(), user.getFriendlyName()); + Message.USER_DEMOTE_ENDOFTRACK_NOT_REMOVED.send(sender, track.getName(), user.getFormattedDisplayName()); return CommandResult.STATE_ERROR; } - Message.USER_DEMOTE_ENDOFTRACK.send(sender, track.getName(), user.getFriendlyName(), result.getGroupFrom().get()); + Message.USER_DEMOTE_ENDOFTRACK.send(sender, track.getName(), user.getFormattedDisplayName(), result.getGroupFrom().get()); ExtendedLogEntry.build().actor(sender).acted(user) .action("demote", track.getName(), context) @@ -128,7 +128,7 @@ public class UserDemote extends SubCommand { String groupFrom = result.getGroupFrom().get(); String groupTo = result.getGroupTo().get(); - Message.USER_DEMOTE_SUCCESS.send(sender, user.getFriendlyName(), track.getName(), groupFrom, groupTo, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.USER_DEMOTE_SUCCESS.send(sender, user.getFormattedDisplayName(), track.getName(), groupFrom, groupTo, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); if (!silent) { Message.EMPTY.send(sender, MessageUtils.listToArrowSep(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 8610198e..0c1fe73e 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 @@ -102,19 +102,19 @@ public class UserPromote extends SubCommand { Message.COMMAND_NO_PERMISSION.send(sender); return CommandResult.NO_PERMISSION; case AMBIGUOUS_CALL: - Message.TRACK_AMBIGUOUS_CALL.send(sender, user.getFriendlyName()); + Message.TRACK_AMBIGUOUS_CALL.send(sender, user.getFormattedDisplayName()); return CommandResult.FAILURE; case END_OF_TRACK: - Message.USER_PROMOTE_ERROR_ENDOFTRACK.send(sender, track.getName(), user.getFriendlyName()); + Message.USER_PROMOTE_ERROR_ENDOFTRACK.send(sender, track.getName(), user.getFormattedDisplayName()); return CommandResult.STATE_ERROR; case ADDED_TO_FIRST_GROUP: { if (!addToFirst && !result.getGroupTo().isPresent()) { - Message.USER_PROMOTE_NOT_ON_TRACK.send(sender, track.getName(), user.getFriendlyName()); + Message.USER_PROMOTE_NOT_ON_TRACK.send(sender, track.getName(), user.getFormattedDisplayName()); return CommandResult.STATE_ERROR; } - Message.USER_TRACK_ADDED_TO_FIRST.send(sender, user.getFriendlyName(), result.getGroupTo().get(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.USER_TRACK_ADDED_TO_FIRST.send(sender, user.getFormattedDisplayName(), result.getGroupTo().get(), MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); ExtendedLogEntry.build().actor(sender).acted(user) .action("promote", track.getName(), context) @@ -128,7 +128,7 @@ public class UserPromote extends SubCommand { String groupFrom = result.getGroupFrom().get(); String groupTo = result.getGroupTo().get(); - Message.USER_PROMOTE_SUCCESS.send(sender, user.getFriendlyName(), track.getName(), groupFrom, groupTo, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); + Message.USER_PROMOTE_SUCCESS.send(sender, user.getFormattedDisplayName(), track.getName(), groupFrom, groupTo, MessageUtils.contextSetToString(plugin.getLocaleManager(), context)); if (!silent) { Message.EMPTY.send(sender, MessageUtils.listToArrowSep(track.getGroups(), groupFrom, groupTo, false)); } diff --git a/common/src/main/java/me/lucko/luckperms/common/messaging/LuckPermsMessagingService.java b/common/src/main/java/me/lucko/luckperms/common/messaging/LuckPermsMessagingService.java index 226a55e8..8df1f5fb 100644 --- a/common/src/main/java/me/lucko/luckperms/common/messaging/LuckPermsMessagingService.java +++ b/common/src/main/java/me/lucko/luckperms/common/messaging/LuckPermsMessagingService.java @@ -123,7 +123,7 @@ public class LuckPermsMessagingService implements InternalMessagingService, Inco public void pushUserUpdate(User user) { this.plugin.getBootstrap().getScheduler().executeAsync(() -> { UUID requestId = generatePingId(); - this.plugin.getLogger().info("[Messaging] Sending user ping for '" + user.getFriendlyName() + "' with id: " + requestId); + this.plugin.getLogger().info("[Messaging] Sending user ping for '" + user.getPlainDisplayName() + "' with id: " + requestId); this.messenger.sendOutgoingMessage(new UserUpdateMessageImpl(requestId, user.getUuid())); }); } @@ -248,7 +248,7 @@ public class LuckPermsMessagingService implements InternalMessagingService, Inco return; } - this.plugin.getLogger().info("[Messaging] Received user update ping for '" + user.getFriendlyName() + "' with id: " + msg.getId()); + this.plugin.getLogger().info("[Messaging] Received user update ping for '" + user.getPlainDisplayName() + "' with id: " + msg.getId()); if (this.plugin.getEventFactory().handleNetworkPreSync(false, msg.getId())) { return; 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 2d623d80..0b277200 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 @@ -92,11 +92,16 @@ public class Group extends PermissionHolder implements Identifiable { } @Override - public String getFriendlyName() { + public String getFormattedDisplayName() { Optional dn = getDisplayName(); return dn.map(s -> this.name + " &r(" + s + "&r)").orElse(this.name); } + @Override + public String getPlainDisplayName() { + return getDisplayName().orElse(getName()); + } + public Optional getDisplayName() { return this.displayNameCache.get(); } 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 596a5a7d..b064f56b 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 @@ -184,11 +184,19 @@ public abstract class PermissionHolder { public abstract String getObjectName(); /** - * Gets the friendly name of this permission holder (for use in commands, etc) + * Gets the formatted display name of this permission holder + * (for use in commands, etc) * - * @return the holders "friendly" name + * @return the holders formatted display name */ - public abstract String getFriendlyName(); + public abstract String getFormattedDisplayName(); + + /** + * Gets a display name for this permission holder, without any formatting. + * + * @return the display name + */ + public abstract String getPlainDisplayName(); /** * Gets the holders cached data 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 3acf9f84..a2dfc3ea 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 @@ -105,10 +105,15 @@ public class User extends PermissionHolder implements Identifiable { if (holder.getType().isUser()) { obj.add("uuid", ((User) holder).getUuid().toString());