1
0
mirror of https://github.com/lucko/LuckPerms.git synced 2025-09-01 18:32:33 +02:00

Add date on hover to actionlog (#3597)

This commit is contained in:
Josh
2023-05-01 09:32:18 +01:00
committed by GitHub
parent ef85fa8941
commit cfe0d806a1
2 changed files with 7 additions and 0 deletions

View File

@@ -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)
)

View File

@@ -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