Include expiry in meta info command (#2663)

This commit is contained in:
Luck 2020-10-20 13:10:39 +01:00
parent b9eb022011
commit 6b05e47deb
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -2139,12 +2139,28 @@ public interface Message {
);
Args3<ChatMetaNode<?, ?>, PermissionHolder, String> CHAT_META_ENTRY = (node, holder, label) -> prefixed(text()
// "&b-> {} &f- &f'{}&f' &8(&7inherited from &a{}&8) {}"
// "&b-> {} &f- &f'{}&f' &8(&7expires in &b{}&8) &8(&7inherited from &a{}&8) {}"
.append(text("->", AQUA))
.append(space())
.append(text(node.getPriority(), AQUA))
.append(text(" - ", WHITE))
.append(text().color(WHITE).append(text('\'')).append(formatColoredValue(node.getMetaValue())).append(text('\'')))
.apply(builder -> {
if (node.hasExpiry()) {
builder.append(space());
builder.append(text()
.color(DARK_GRAY)
.append(OPEN_BRACKET)
.append(translatable()
.key("luckperms.command.generic.info.expires-in")
.color(GRAY)
.append(space())
.append(text(DurationFormatter.CONCISE.format(node.getExpiryDuration()), AQUA))
)
.append(CLOSE_BRACKET)
);
}
})
.append(space())
.append(text()
.color(DARK_GRAY)
@ -2191,12 +2207,28 @@ public interface Message {
));
Args3<MetaNode, PermissionHolder, String> META_ENTRY = (node, holder, label) -> prefixed(text()
// "&b-> &a{} &f= &f'{}&f' &8(&7inherited from &a{}&8) {}"
// "&b-> &a{} &f= &f'{}&f' &8(&7expires in &b{}&8) &8(&7inherited from &a{}&8) {}"
.append(text("->", AQUA))
.append(space())
.append(text(node.getMetaKey(), GREEN))
.append(text(" = ", WHITE))
.append(text().color(WHITE).append(text('\'')).append(formatColoredValue(node.getMetaValue())).append(text('\'')))
.apply(builder -> {
if (node.hasExpiry()) {
builder.append(space());
builder.append(text()
.color(DARK_GRAY)
.append(OPEN_BRACKET)
.append(translatable()
.key("luckperms.command.generic.info.expires-in")
.color(GRAY)
.append(space())
.append(text(DurationFormatter.CONCISE.format(node.getExpiryDuration()), AQUA))
)
.append(CLOSE_BRACKET)
);
}
})
.append(space())
.append(text()
.color(DARK_GRAY)