Add date on hover to actionlog (#3597)

This commit is contained in:
Josh authored and GitHub committed 2023-05-01 09:32:18 +01:00
1 parent ef85fa8941
commit cfe0d806a1
2 files changed
+7

No files matched your search

@@ -55,6 +55,8 @@ import net.luckperms.api.util.Tristate;
import java.time.Duration;
import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -88,6 +90,9 @@ import static net.kyori.adventure.text.format.TextDecoration.BOLD;
*/
public interface Message {
static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd '@' HH:mm:ss")
.withZone(ZoneId.systemDefault());
TextComponent OPEN_BRACKET = Component.text('(');
TextComponent CLOSE_BRACKET = Component.text(')');
TextComponent FULL_STOP = Component.text('.');
@@ -3717,6 +3722,7 @@ public interface Message {
.color(GRAY)
.key("luckperms.duration.since")
.args(DurationFormatter.CONCISE_LOW_ACCURACY.format(action.getDurationSince()))
.hoverEvent(HoverEvent.showText(text().append(translatable("luckperms.duration.date", GRAY)).append(text(": ", GRAY)).append(text(DATE_FORMAT.format(action.getTimestamp()), AQUA))))
)
.append(CLOSE_BRACKET)
)
@@ -54,6 +54,7 @@ luckperms.duration.unit.seconds.plural={0} seconds
luckperms.duration.unit.seconds.singular={0} second
luckperms.duration.unit.seconds.short={0}s
luckperms.duration.since={0} ago
luckperms.duration.date=Date
luckperms.command.misc.invalid-code=Invalid code
luckperms.command.misc.response-code-key=response code
luckperms.command.misc.error-message-key=message