mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-27 21:29:47 +01:00
Separate formatted vs plain display name methods in User/Group
Continues from 3c773e6823
& #1210
This commit is contained in:
parent
3c773e6823
commit
dd78e0e271
@ -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));
|
||||
|
@ -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()) {
|
||||
|
@ -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
|
||||
|
@ -42,6 +42,6 @@ public class GroupCachedData extends HolderCachedData<Group> 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());
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,6 @@ public class UserCachedData extends HolderCachedData<User> 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());
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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 -> {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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),
|
||||
'¥'
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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),
|
||||
'¥'
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -75,9 +75,9 @@ public class HolderClear<T extends PermissionHolder> extends SubCommand<T> {
|
||||
|
||||
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)
|
||||
|
@ -102,11 +102,11 @@ public class HolderShowTracks<T extends PermissionHolder> extends SubCommand<T>
|
||||
}
|
||||
|
||||
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<Track, String> line : lines) {
|
||||
Message.LIST_TRACKS_ENTRY.send(sender, line.getKey().getName(), line.getValue());
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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<LocalizedNode> 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 -> {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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<LocalizedNode> 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 -> {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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")
|
||||
|
@ -58,7 +58,7 @@ public class GroupInfo extends SubCommand<Group> {
|
||||
|
||||
Message.GROUP_INFO_GENERAL.send(sender,
|
||||
group.getName(),
|
||||
group.getDisplayName().orElse(group.getName()),
|
||||
group.getPlainDisplayName(),
|
||||
group.getWeight().isPresent() ? group.getWeight().getAsInt() : "None"
|
||||
);
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class GroupRename extends SubCommand<Group> {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class GroupSetWeight extends SubCommand<Group> {
|
||||
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)
|
||||
|
@ -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)
|
||||
);
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class UserClone extends SubCommand<User> {
|
||||
|
||||
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())
|
||||
|
@ -96,10 +96,10 @@ public class UserDemote extends SubCommand<User> {
|
||||
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<User> {
|
||||
|
||||
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<User> {
|
||||
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));
|
||||
}
|
||||
|
@ -102,19 +102,19 @@ public class UserPromote extends SubCommand<User> {
|
||||
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<User> {
|
||||
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));
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -92,11 +92,16 @@ public class Group extends PermissionHolder implements Identifiable<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
public String getFormattedDisplayName() {
|
||||
Optional<String> dn = getDisplayName();
|
||||
return dn.map(s -> this.name + " &r(" + s + "&r)").orElse(this.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlainDisplayName() {
|
||||
return getDisplayName().orElse(getName());
|
||||
}
|
||||
|
||||
public Optional<String> getDisplayName() {
|
||||
return this.displayNameCache.get();
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -105,10 +105,15 @@ public class User extends PermissionHolder implements Identifiable<UserIdentifie
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
public String getFormattedDisplayName() {
|
||||
return this.name != null ? this.name : this.uuid.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlainDisplayName() {
|
||||
return getFormattedDisplayName();
|
||||
}
|
||||
|
||||
public ApiUser getApiDelegate() {
|
||||
return this.apiDelegate;
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ public class SeparatedConfigurateDao extends AbstractConfigurateDao {
|
||||
|
||||
User u = this.plugin.getUserManager().getIfLoaded(uuid);
|
||||
if (u != null) {
|
||||
this.plugin.getLogger().info("[FileWatcher] Detected change in user file for " + u.getFriendlyName() + " - reloading...");
|
||||
this.plugin.getLogger().info("[FileWatcher] Detected change in user file for " + u.getPlainDisplayName() + " - reloading...");
|
||||
this.plugin.getStorage().loadUser(uuid, null);
|
||||
}
|
||||
});
|
||||
|
@ -142,7 +142,7 @@ public class TreeView {
|
||||
JObject checks;
|
||||
if (user != null && checker != null) {
|
||||
metadata.add("referenceUser", new JObject()
|
||||
.add("name", user.getFriendlyName())
|
||||
.add("name", user.getPlainDisplayName())
|
||||
.add("uuid", user.getUuid().toString())
|
||||
);
|
||||
|
||||
|
@ -72,7 +72,7 @@ public final class WebEditor {
|
||||
return new JObject()
|
||||
.add("who", new JObject()
|
||||
.add("id", getHolderIdentifier(holder))
|
||||
.add("friendly", holder.getFriendlyName())
|
||||
.add("friendly", holder.getPlainDisplayName())
|
||||
.consume(obj -> {
|
||||
if (holder.getType().isUser()) {
|
||||
obj.add("uuid", ((User) holder).getUuid().toString());
|
||||
|
Loading…
Reference in New Issue
Block a user