Render minimessage in prefix/suffix/meta values (#3672)

This commit is contained in:
powercas_gamer 2023-06-24 01:24:16 +02:00 committed by GitHub
parent 86cc90f48a
commit 35dfc2c8f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 77 additions and 53 deletions

View File

@ -45,6 +45,11 @@ dependencies {
exclude(module: 'adventure-api') exclude(module: 'adventure-api')
} }
api("net.kyori:adventure-text-minimessage:4.11.0") {
exclude(module: 'adventure-bom')
exclude(module: 'adventure-api')
}
api('net.kyori:event-api:3.0.0') { api('net.kyori:event-api:3.0.0') {
exclude(module: 'checker-qual') exclude(module: 'checker-qual')
exclude(module: 'guava') exclude(module: 'guava')

View File

@ -59,33 +59,32 @@ public enum Dependency {
"1.7", "1.7",
"b30RhOF6kHiHl+O5suNLh/+eAr1iOFEFLXhwkHHDu4I=" "b30RhOF6kHiHl+O5suNLh/+eAr1iOFEFLXhwkHHDu4I="
), ),
ADVENTURE( ADVENTURE(
"me{}lucko", "me{}lucko",
"adventure-api", "adventure-api",
"4.11.0", "4.13.0",
"7xrFaBbsTiQPZKBDzvDnTd8XIgOsHTy9qQICm3342GU=", "gcmYlY1KDrzbnE9nB8rA44oBZKPSMvv9kNRefoEuud0=",
Relocation.of("adventure", "net{}kyori{}adventure") Relocation.of("adventure", "net{}kyori{}adventure")
), ),
ADVENTURE_PLATFORM( ADVENTURE_PLATFORM(
"me{}lucko", "me{}lucko",
"adventure-platform-api", "adventure-platform-api",
"4.11.2", "4.13.0",
"zCnxNgosme++TsheFaL+YHdtRIrp+oJhUiI8awsKgfQ=", "Kk8IkEMVa9ITBfC3yocpcXQiZ9CwN9VxeWjKUD8I0n0=",
Relocation.of("adventure", "net{}kyori{}adventure") Relocation.of("adventure", "net{}kyori{}adventure")
), ),
ADVENTURE_PLATFORM_BUKKIT( ADVENTURE_PLATFORM_BUKKIT(
"me{}lucko", "me{}lucko",
"adventure-platform-bukkit", "adventure-platform-bukkit",
"4.11.2", "4.13.0",
"mrtYZvt00GH4oejuBJ2QEbFkmz1F+PGmthPwroSxCgo=", "Rif/+xdGfRrlhxXYb2+jMFBnwnLQ2pnjAJ/BxWApins=",
Relocation.of("adventure", "net{}kyori{}adventure") Relocation.of("adventure", "net{}kyori{}adventure")
), ),
ADVENTURE_PLATFORM_BUNGEECORD( ADVENTURE_PLATFORM_BUNGEECORD(
"me{}lucko", "me{}lucko",
"adventure-platform-bungeecord", "adventure-platform-bungeecord",
"4.11.2", "4.13.0",
"+WUdRdZ6qkacw3ha/R3ayLx46soMywGe70Zmnw4yha8=", "MLk/qAgWC9YT2ImLq/sVo114V5Rk1jQr4jc57WAoO74=",
Relocation.of("adventure", "net{}kyori{}adventure") Relocation.of("adventure", "net{}kyori{}adventure")
), ),
EVENT( EVENT(

View File

@ -39,9 +39,11 @@ import me.lucko.luckperms.common.sender.Sender;
import me.lucko.luckperms.common.util.DurationFormatter; import me.lucko.luckperms.common.util.DurationFormatter;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.ComponentLike; import net.kyori.adventure.text.ComponentLike;
import net.kyori.adventure.text.JoinConfiguration;
import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.event.HoverEvent; import net.kyori.adventure.text.event.HoverEvent;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import net.luckperms.api.context.Context; import net.luckperms.api.context.Context;
import net.luckperms.api.context.ContextSet; import net.luckperms.api.context.ContextSet;
@ -96,7 +98,7 @@ public interface Message {
TextComponent OPEN_BRACKET = Component.text('('); TextComponent OPEN_BRACKET = Component.text('(');
TextComponent CLOSE_BRACKET = Component.text(')'); TextComponent CLOSE_BRACKET = Component.text(')');
TextComponent FULL_STOP = Component.text('.'); TextComponent FULL_STOP = Component.text('.');
Component PREFIX_COMPONENT = text() Component PREFIX_COMPONENT = text()
.color(GRAY) .color(GRAY)
.append(text('[')) .append(text('['))
@ -135,7 +137,7 @@ public interface Message {
// " | |__) " // " | |__) "
// " |___ | " // " |___ | "
return join(newline(), return joinNewline(
text() text()
.append(text(" ", AQUA)) .append(text(" ", AQUA))
.append(text(" __ ", DARK_AQUA)) .append(text(" __ ", DARK_AQUA))
@ -175,7 +177,7 @@ public interface Message {
.color(GRAY) .color(GRAY)
); );
Args2<String, String> FIRST_TIME_SETUP = (label, username) -> join(newline(), Args2<String, String> FIRST_TIME_SETUP = (label, username) -> joinNewline(
// "&3It seems that no permissions have been setup yet!" // "&3It seems that no permissions have been setup yet!"
// "&3Before you can use any of the LuckPerms commands in-game, you need to use the console to give yourself access." // "&3Before you can use any of the LuckPerms commands in-game, you need to use the console to give yourself access."
// "&3Open your console and run:" // "&3Open your console and run:"
@ -278,7 +280,7 @@ public interface Message {
.append(FULL_STOP) .append(FULL_STOP)
); );
Args1<LoggedAction> LOG = action -> join(newline(), Args1<LoggedAction> LOG = action -> joinNewline(
// "&3LOG &3&l> &8(&e{}&8) [&a{}&8] (&b{}&8)" // "&3LOG &3&l> &8(&e{}&8) [&a{}&8] (&b{}&8)"
// "&3LOG &3&l> &f{}" // "&3LOG &3&l> &f{}"
prefixed(text() prefixed(text()
@ -489,7 +491,7 @@ public interface Message {
.append(CLOSE_BRACKET) .append(CLOSE_BRACKET)
)); ));
Args2<String, Component> COMMAND_USAGE_DETAILED_HEADER = (name, usage) -> join(newline(), Args2<String, Component> COMMAND_USAGE_DETAILED_HEADER = (name, usage) -> joinNewline(
// "&3&lCommand Usage &3- &b{}" // "&3&lCommand Usage &3- &b{}"
// "&b> &7{}" // "&b> &7{}"
prefixed(text() prefixed(text()
@ -666,7 +668,7 @@ public interface Message {
.append(FULL_STOP) .append(FULL_STOP)
); );
Args0 VERBOSE_OFF_COMMAND_NO_CHECKS = () -> join(newline(), Args0 VERBOSE_OFF_COMMAND_NO_CHECKS = () -> joinNewline(
// &bThe command execution completed, but no permission checks were made. // &bThe command execution completed, but no permission checks were made.
// &7This might be because the plugin runs commands in the background (async). You can still use verbose manually to detect checks made like this. // &7This might be because the plugin runs commands in the background (async). You can still use verbose manually to detect checks made like this.
prefixed(translatable() prefixed(translatable()
@ -705,7 +707,7 @@ public interface Message {
.args(translatable("luckperms.command.verbose.disabled-term", RED)) .args(translatable("luckperms.command.verbose.disabled-term", RED))
); );
Args1<String> VERBOSE_RESULTS_URL = url -> join(newline(), Args1<String> VERBOSE_RESULTS_URL = url -> joinNewline(
// "&aVerbose results URL:" // "&aVerbose results URL:"
// <link> // <link>
prefixed(translatable() prefixed(translatable()
@ -731,7 +733,7 @@ public interface Message {
.append(FULL_STOP) .append(FULL_STOP)
); );
Args1<String> TREE_URL = url -> join(newline(), Args1<String> TREE_URL = url -> joinNewline(
// "&aPermission tree URL:" // "&aPermission tree URL:"
// <link> // <link>
prefixed(translatable() prefixed(translatable()
@ -886,7 +888,7 @@ public interface Message {
.apply(builder -> { .apply(builder -> {
boolean explicitGlobalContext = !plugin.getConfiguration().getContextsFile().getDefaultContexts().isEmpty(); boolean explicitGlobalContext = !plugin.getConfiguration().getContextsFile().getDefaultContexts().isEmpty();
Component hover = join(newline(), Component hover = joinNewline(
text() text()
.append(text('>', DARK_AQUA)) .append(text('>', DARK_AQUA))
.append(space()) .append(space())
@ -930,7 +932,7 @@ public interface Message {
.apply(builder -> { .apply(builder -> {
boolean explicitGlobalContext = !plugin.getConfiguration().getContextsFile().getDefaultContexts().isEmpty(); boolean explicitGlobalContext = !plugin.getConfiguration().getContextsFile().getDefaultContexts().isEmpty();
Component hover = join(newline(), Component hover = joinNewline(
text() text()
.append(text('>', DARK_AQUA)) .append(text('>', DARK_AQUA))
.append(space()) .append(space())
@ -949,7 +951,7 @@ public interface Message {
}) })
.build(); .build();
Args2<String, String> APPLY_EDITS_SESSION_UNKNOWN = (code, label) -> join(newline(), Args2<String, String> APPLY_EDITS_SESSION_UNKNOWN = (code, label) -> joinNewline(
// "&4The changes received from the web editor were not made in a session started on this server!" // "&4The changes received from the web editor were not made in a session started on this server!"
// "&cAre you sure you're running the /lp applyedits command in the right place?" // "&cAre you sure you're running the /lp applyedits command in the right place?"
// "&cTo ignore this warning and apply the changes anyway, run: &4/lp applyedits <code> --force" // "&cTo ignore this warning and apply the changes anyway, run: &4/lp applyedits <code> --force"
@ -967,7 +969,7 @@ public interface Message {
.append(text("/" + label + " applyedits " + code + " --force", DARK_RED))) .append(text("/" + label + " applyedits " + code + " --force", DARK_RED)))
); );
Args2<String, String> APPLY_EDITS_SESSION_APPLIED_ALREADY = (code, label) -> join(newline(), Args2<String, String> APPLY_EDITS_SESSION_APPLIED_ALREADY = (code, label) -> joinNewline(
// "&4The changes received from the web editor are based on an initial session which has already been applied!" // "&4The changes received from the web editor are based on an initial session which has already been applied!"
// "&cTo avoid conflicts, you should never re-use the same editor session after the changes from it have been applied once already." // "&cTo avoid conflicts, you should never re-use the same editor session after the changes from it have been applied once already."
// "&cTo ignore this warning and apply the changes anyway, run: /lp applyedits <code> --force" // "&cTo ignore this warning and apply the changes anyway, run: /lp applyedits <code> --force"
@ -1149,7 +1151,7 @@ public interface Message {
.key("luckperms.command.editor.start") .key("luckperms.command.editor.start")
); );
Args1<String> EDITOR_URL = url -> join(newline(), Args1<String> EDITOR_URL = url -> joinNewline(
// "&aClick the link below to open the editor:" // "&aClick the link below to open the editor:"
// <link> // <link>
prefixed(translatable() prefixed(translatable()
@ -1183,7 +1185,7 @@ public interface Message {
.append(FULL_STOP) .append(FULL_STOP)
); );
Args4<String, String, String, Boolean> EDITOR_SOCKET_UNTRUSTED = (nonce, browser, cmdLabel, console) -> join(newline(), Args4<String, String, String, Boolean> EDITOR_SOCKET_UNTRUSTED = (nonce, browser, cmdLabel, console) -> joinNewline(
// "&bAn editor window has connected, but it is not yet trusted." // "&bAn editor window has connected, but it is not yet trusted."
// "&8(&7session id = &faaaaa&7, browser = &fChrome on Windows 10&8)" // "&8(&7session id = &faaaaa&7, browser = &fChrome on Windows 10&8)"
// "&7If it was you, &aclick here&7 to trust the session!" // "&7If it was you, &aclick here&7 to trust the session!"
@ -1229,7 +1231,7 @@ public interface Message {
})) }))
); );
Args0 EDITOR_SOCKET_TRUST_SUCCESS = () -> join(newline(), Args0 EDITOR_SOCKET_TRUST_SUCCESS = () -> joinNewline(
// "&aThe editor session has been marked as trusted." // "&aThe editor session has been marked as trusted."
// "&7In the future, connections from the same browser will be trusted automatically." // "&7In the future, connections from the same browser will be trusted automatically."
// "&7The plugin will now attempt to establish a connection with the editor..." // "&7The plugin will now attempt to establish a connection with the editor..."
@ -1533,7 +1535,7 @@ public interface Message {
) )
); );
Args2<LuckPermsPlugin, Map<Component, Component>> INFO = (plugin, storageMeta) -> join(newline(), Args2<LuckPermsPlugin, Map<Component, Component>> INFO = (plugin, storageMeta) -> joinNewline(
// "&2Running &bLuckPerms v{}&2 by &bLuck&2." // "&2Running &bLuckPerms v{}&2 by &bLuck&2."
// "&f- &3Platform: &f{}" // "&f- &3Platform: &f{}"
// "&f- &3Server Brand: &f{}" // "&f- &3Server Brand: &f{}"
@ -1768,7 +1770,7 @@ public interface Message {
String holderName = holder.getType() == HolderType.GROUP ? holder.getIdentifier().getName() : holder.getPlainDisplayName(); String holderName = holder.getType() == HolderType.GROUP ? holder.getIdentifier().getName() : holder.getPlainDisplayName();
boolean explicitGlobalContext = !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty(); boolean explicitGlobalContext = !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty();
Component hover = join(newline(), Component hover = joinNewline(
text() text()
.append(text('>', DARK_AQUA)) .append(text('>', DARK_AQUA))
.append(space()) .append(space())
@ -1787,7 +1789,7 @@ public interface Message {
}) })
.build(); .build();
Args3<Node, PermissionHolder, String> PERMISSION_INFO_TEMPORARY_NODE_ENTRY = (node, holder, label) -> join(newline(), Args3<Node, PermissionHolder, String> PERMISSION_INFO_TEMPORARY_NODE_ENTRY = (node, holder, label) -> joinNewline(
text() text()
.append(text('>', DARK_AQUA)) .append(text('>', DARK_AQUA))
.append(space()) .append(space())
@ -1798,7 +1800,7 @@ public interface Message {
String holderName = holder.getType() == HolderType.GROUP ? holder.getIdentifier().getName() : holder.getPlainDisplayName(); String holderName = holder.getType() == HolderType.GROUP ? holder.getIdentifier().getName() : holder.getPlainDisplayName();
boolean explicitGlobalContext = !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty(); boolean explicitGlobalContext = !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty();
Component hover = join(newline(), Component hover = joinNewline(
text() text()
.append(text('>', DARK_AQUA)) .append(text('>', DARK_AQUA))
.append(space()) .append(space())
@ -1868,7 +1870,7 @@ public interface Message {
String holderName = holder.getType() == HolderType.GROUP ? holder.getIdentifier().getName() : holder.getPlainDisplayName(); String holderName = holder.getType() == HolderType.GROUP ? holder.getIdentifier().getName() : holder.getPlainDisplayName();
boolean explicitGlobalContext = !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty(); boolean explicitGlobalContext = !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty();
Component hover = join(newline(), Component hover = joinNewline(
text() text()
.append(text('>', DARK_AQUA)) .append(text('>', DARK_AQUA))
.append(space()) .append(space())
@ -1890,7 +1892,7 @@ public interface Message {
.append(formatContextSetBracketed(node.getContexts(), empty())) .append(formatContextSetBracketed(node.getContexts(), empty()))
.build(); .build();
Args3<InheritanceNode, PermissionHolder, String> PARENT_INFO_TEMPORARY_NODE_ENTRY = (node, holder, label) -> join(newline(), Args3<InheritanceNode, PermissionHolder, String> PARENT_INFO_TEMPORARY_NODE_ENTRY = (node, holder, label) -> joinNewline(
text() text()
.append(text('>', DARK_AQUA)) .append(text('>', DARK_AQUA))
.append(space()) .append(space())
@ -1901,7 +1903,7 @@ public interface Message {
String holderName = holder.getType() == HolderType.GROUP ? holder.getIdentifier().getName() : holder.getPlainDisplayName(); String holderName = holder.getType() == HolderType.GROUP ? holder.getIdentifier().getName() : holder.getPlainDisplayName();
boolean explicitGlobalContext = !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty(); boolean explicitGlobalContext = !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty();
Component hover = join(newline(), Component hover = joinNewline(
text() text()
.append(text('>', DARK_AQUA)) .append(text('>', DARK_AQUA))
.append(text(node.getGroupName(), WHITE)), .append(text(node.getGroupName(), WHITE)),
@ -1938,7 +1940,7 @@ public interface Message {
.append(text(':')) .append(text(':'))
); );
Args3<String, ContextSet, Component> LIST_TRACKS_ENTRY = (name, contextSet, path) -> join(newline(), Args3<String, ContextSet, Component> LIST_TRACKS_ENTRY = (name, contextSet, path) -> joinNewline(
// "&3> &a{}: {}" // "&3> &a{}: {}"
// "&7 ({}&7)" // "&7 ({}&7)"
text() text()
@ -2040,7 +2042,7 @@ public interface Message {
) )
); );
Args5<String, Tristate, String, Node, ContextSet> PERMISSION_CHECK_RESULT = (permission, result, processor, causeNode, context) -> join(newline(), Args5<String, Tristate, String, Node, ContextSet> PERMISSION_CHECK_RESULT = (permission, result, processor, causeNode, context) -> joinNewline(
// &aPermission check for &b{}&a: // &aPermission check for &b{}&a:
// &3Result: {} // &3Result: {}
// &3Processor: &f{} // &3Processor: &f{}
@ -2516,7 +2518,7 @@ public interface Message {
HolderType originType = HolderType.valueOf(origin.getOrigin().getType().toUpperCase(Locale.ROOT)); HolderType originType = HolderType.valueOf(origin.getOrigin().getType().toUpperCase(Locale.ROOT));
boolean explicitGlobalContext = !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty(); boolean explicitGlobalContext = !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty();
Component hover = join(newline(), Component hover = joinNewline(
text() text()
.append(text('>', DARK_AQUA)) .append(text('>', DARK_AQUA))
.append(space()) .append(space())
@ -2591,7 +2593,7 @@ public interface Message {
HolderType originType = HolderType.valueOf(origin.getOrigin().getType().toUpperCase(Locale.ROOT)); HolderType originType = HolderType.valueOf(origin.getOrigin().getType().toUpperCase(Locale.ROOT));
boolean explicitGlobalContext = !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty(); boolean explicitGlobalContext = !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty();
Component hover = join(newline(), Component hover = joinNewline(
text() text()
.append(text('>', DARK_AQUA)) .append(text('>', DARK_AQUA))
.append(space()) .append(space())
@ -2987,7 +2989,7 @@ public interface Message {
.append(FULL_STOP) .append(FULL_STOP)
); );
Args3<Integer, Integer, Integer> BULK_UPDATE_STATISTICS = (nodes, users, groups) -> join(newline(), Args3<Integer, Integer, Integer> BULK_UPDATE_STATISTICS = (nodes, users, groups) -> joinNewline(
// "&bTotal affected nodes: &a{}" // "&bTotal affected nodes: &a{}"
// "&bTotal affected users: &a{}" // "&bTotal affected users: &a{}"
// "&bTotal affected groups: &a{}" // "&bTotal affected groups: &a{}"
@ -3069,7 +3071,7 @@ public interface Message {
}) })
); );
Args1<String> TRANSLATIONS_DOWNLOAD_PROMPT = label -> join(newline(), Args1<String> TRANSLATIONS_DOWNLOAD_PROMPT = label -> joinNewline(
// "Use /lp translations install to download and install up-to-date versions of these translations provided by the community." // "Use /lp translations install to download and install up-to-date versions of these translations provided by the community."
// "Please note that this will override any changes you've made for these languages." // "Please note that this will override any changes you've made for these languages."
prefixed(translatable() prefixed(translatable()
@ -3113,7 +3115,7 @@ public interface Message {
.append(FULL_STOP) .append(FULL_STOP)
); );
Args4<String, String, Component, Boolean> USER_INFO_GENERAL = (username, uuid, uuidType, online) -> join(newline(), Args4<String, String, Component, Boolean> USER_INFO_GENERAL = (username, uuid, uuidType, online) -> joinNewline(
// "&b&l> &bUser Info: &f{}" // "&b&l> &bUser Info: &f{}"
// "&f- &3UUID: &f{}" // "&f- &3UUID: &f{}"
// "&f &7(type: {}&7)" // "&f &7(type: {}&7)"
@ -3147,7 +3149,7 @@ public interface Message {
.append(online ? translatable("luckperms.command.user.info.status.online", GREEN) : translatable("luckperms.command.user.info.status.offline", RED))) .append(online ? translatable("luckperms.command.user.info.status.online", GREEN) : translatable("luckperms.command.user.info.status.offline", RED)))
); );
Args6<Boolean, ContextSet, String, String, String, Map<String, List<String>>> USER_INFO_CONTEXTUAL_DATA = (active, contexts, prefix, suffix, primaryGroup, meta) -> join(newline(), Args6<Boolean, ContextSet, String, String, String, Map<String, List<String>>> USER_INFO_CONTEXTUAL_DATA = (active, contexts, prefix, suffix, primaryGroup, meta) -> joinNewline(
// "&f- &aContextual Data: &7(mode: {}&7)" // "&f- &aContextual Data: &7(mode: {}&7)"
// " &3Contexts: {}" // " &3Contexts: {}"
// " &3Prefix: {}" // " &3Prefix: {}"
@ -3234,7 +3236,7 @@ public interface Message {
.build() .build()
) )
.collect(Collectors.toList()); .collect(Collectors.toList());
builder.append(join(space(), entries)); builder.append(join(JoinConfiguration.separator(space()), entries));
} }
})) }))
); );
@ -3261,7 +3263,7 @@ public interface Message {
.append(formatContextSetBracketed(node.getContexts(), empty())) .append(formatContextSetBracketed(node.getContexts(), empty()))
); );
Args1<InheritanceNode> INFO_PARENT_TEMPORARY_NODE_ENTRY = node -> join(newline(), Args1<InheritanceNode> INFO_PARENT_TEMPORARY_NODE_ENTRY = node -> joinNewline(
prefixed(text() prefixed(text()
.append(text(" > ", DARK_AQUA)) .append(text(" > ", DARK_AQUA))
.append(text(node.getGroupName(), WHITE)) .append(text(node.getGroupName(), WHITE))
@ -3390,7 +3392,7 @@ public interface Message {
.append(FULL_STOP) .append(FULL_STOP)
); );
Args1<String> USER_PROMOTE_ERROR_MALFORMED = name -> join(newline(), Args1<String> USER_PROMOTE_ERROR_MALFORMED = name -> joinNewline(
// "&aThe next group on the track, &b{}&a, no longer exists. Unable to promote user." // "&aThe next group on the track, &b{}&a, no longer exists. Unable to promote user."
// "&aEither create the group, or remove it from the track and try again." // "&aEither create the group, or remove it from the track and try again."
prefixed(translatable() prefixed(translatable()
@ -3444,7 +3446,7 @@ public interface Message {
.append(FULL_STOP) .append(FULL_STOP)
); );
Args1<String> USER_DEMOTE_ERROR_MALFORMED = name -> join(newline(), Args1<String> USER_DEMOTE_ERROR_MALFORMED = name -> joinNewline(
// "&aThe previous group on the track, &b{}&a, no longer exists. Unable to demote user." // "&aThe previous group on the track, &b{}&a, no longer exists. Unable to demote user."
// "&aEither create the group, or remove it from the track and try again." // "&aEither create the group, or remove it from the track and try again."
prefixed(translatable() prefixed(translatable()
@ -3461,7 +3463,7 @@ public interface Message {
.append(FULL_STOP)) .append(FULL_STOP))
); );
Args3<String, String, OptionalInt> GROUP_INFO_GENERAL = (name, displayName, weight) -> join(newline(), Args3<String, String, OptionalInt> GROUP_INFO_GENERAL = (name, displayName, weight) -> joinNewline(
// "&b&l> &bGroup Info: &f{}" // "&b&l> &bGroup Info: &f{}"
// "&f- &3Display Name: &f{}" // "&f- &3Display Name: &f{}"
// "&f- &3Weight: &f{}" // "&f- &3Weight: &f{}"
@ -3486,7 +3488,7 @@ public interface Message {
.append(weight.isPresent() ? text(weight.getAsInt(), WHITE) : translatable("luckperms.command.generic.contextual-data.null-result", WHITE))) .append(weight.isPresent() ? text(weight.getAsInt(), WHITE) : translatable("luckperms.command.generic.contextual-data.null-result", WHITE)))
); );
Args3<String, String, Map<String, List<String>>> GROUP_INFO_CONTEXTUAL_DATA = (prefix, suffix, meta) -> join(newline(), Args3<String, String, Map<String, List<String>>> GROUP_INFO_CONTEXTUAL_DATA = (prefix, suffix, meta) -> joinNewline(
// "&f- &aContextual Data: &7(mode: &8server&7)" // "&f- &aContextual Data: &7(mode: &8server&7)"
// " &3Prefix: {}" // " &3Prefix: {}"
// " &3Suffix: {}" // " &3Suffix: {}"
@ -3559,7 +3561,7 @@ public interface Message {
.build() .build()
) )
.collect(Collectors.toList()); .collect(Collectors.toList());
builder.append(join(space(), entries)); builder.append(join(JoinConfiguration.separator(space()), entries));
} }
})) }))
); );
@ -3615,7 +3617,7 @@ public interface Message {
.append(FULL_STOP) .append(FULL_STOP)
); );
Args2<String, Component> TRACK_INFO = (name, path) -> join(newline(), Args2<String, Component> TRACK_INFO = (name, path) -> joinNewline(
// "&b&l> &bShowing Track: &f{}" + "\n" + // "&b&l> &bShowing Track: &f{}" + "\n" +
// "&f- &7Path: &f{}", // "&f- &7Path: &f{}",
prefixed(text() prefixed(text()
@ -3721,7 +3723,7 @@ public interface Message {
.append(FULL_STOP) .append(FULL_STOP)
); );
Args2<Integer, LoggedAction> LOG_ENTRY = (pos, action) -> join(newline(), Args2<Integer, LoggedAction> LOG_ENTRY = (pos, action) -> joinNewline(
// "&b#{} &8(&7{} ago&8) &8(&e{}&8) [&a{}&8] (&b{}&8)" // "&b#{} &8(&7{} ago&8) &8(&e{}&8) [&a{}&8] (&b{}&8)"
// "&7> &f{}" // "&7> &f{}"
prefixed(text() prefixed(text()
@ -3982,7 +3984,7 @@ public interface Message {
.append(FULL_STOP) .append(FULL_STOP)
); );
Args2<String, String> EXPORT_WEB_SUCCESS = (pasteId, label) -> join(newline(), Args2<String, String> EXPORT_WEB_SUCCESS = (pasteId, label) -> joinNewline(
// "&aExport code: &7{}" // "&aExport code: &7{}"
// "&7Use the following command to import:" // "&7Use the following command to import:"
// "&a/{} import {} --upload" // "&a/{} import {} --upload"
@ -3995,7 +3997,8 @@ public interface Message {
.key("luckperms.command.export.web.import-command-description") .key("luckperms.command.export.web.import-command-description")
.color(GRAY) .color(GRAY)
.append(text(":")), .append(text(":")),
text("/" + label + " import " + pasteId + " --upload", GREEN)); text("/" + label + " import " + pasteId + " --upload", GREEN)
);
Args1<String> IMPORT_FILE_DOESNT_EXIST = file -> prefixed(text() Args1<String> IMPORT_FILE_DOESNT_EXIST = file -> prefixed(text()
// "&cError: File &4{}&c does not exist." // "&cError: File &4{}&c does not exist."
@ -4150,9 +4153,18 @@ public interface Message {
); );
static Component formatColoredValue(String value) { static Component formatColoredValue(String value) {
return LegacyComponentSerializer.legacyAmpersand().deserialize(value).toBuilder() boolean containsLegacyFormattingCharacter = value.indexOf(LegacyComponentSerializer.AMPERSAND_CHAR) != 1
.hoverEvent(HoverEvent.showText(text(value, WHITE))) || value.indexOf(LegacyComponentSerializer.SECTION_CHAR) != 1;
.build();
HoverEvent<Component> hover = HoverEvent.showText(text(value, WHITE));
if (containsLegacyFormattingCharacter) {
return LegacyComponentSerializer.legacyAmpersand().deserialize(value).toBuilder()
.hoverEvent(hover)
.build();
} else {
return MiniMessage.miniMessage().deserialize(value).hoverEvent(hover);
}
} }
static Component formatContextBracketed(String key, String value) { static Component formatContextBracketed(String key, String value) {
@ -4320,6 +4332,10 @@ public interface Message {
} }
} }
static Component joinNewline(final ComponentLike... components) {
return join(JoinConfiguration.newlines(), components);
}
interface Args0 { interface Args0 {
Component build(); Component build();

View File

@ -36,6 +36,10 @@ dependencies {
exclude(module: 'adventure-bom') exclude(module: 'adventure-bom')
exclude(module: 'adventure-api') exclude(module: 'adventure-api')
} }
api('net.kyori:adventure-text-minimessage:4.14.0') {
exclude(module: 'adventure-bom')
exclude(module: 'adventure-api')
}
api('net.kyori:ansi:1.0.1') api('net.kyori:ansi:1.0.1')
} }