From 3ba59c84768ad32297e80ee0a0f1f0ce26153f47 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 1 Apr 2022 09:38:17 +0200 Subject: [PATCH] Update CheckCommand --- src/de/steamwar/bungeecore/commands/CheckCommand.java | 8 ++++++++ src/de/steamwar/messages/BungeeCore.properties | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/CheckCommand.java b/src/de/steamwar/bungeecore/commands/CheckCommand.java index b65b1cc4..6fdc6c37 100644 --- a/src/de/steamwar/bungeecore/commands/CheckCommand.java +++ b/src/de/steamwar/bungeecore/commands/CheckCommand.java @@ -34,8 +34,11 @@ import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.config.Configuration; +import java.sql.Time; import java.sql.Timestamp; +import java.time.Duration; import java.time.Instant; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.concurrent.TimeUnit; import java.util.logging.Level; @@ -127,13 +130,18 @@ public class CheckCommand extends BasicCommand { for (SchematicNode schematic : schematicList) { CheckSession current = currentSchems.get(schematic.getId()); + long waitedMillis = Timestamp.from(Instant.now()).getTime() - schematic.getLastUpdate().getTime(); + String color = waitedMillis > 14400000 ? (waitedMillis > 86400000 ? "§c" : "§e") : "§a"; + String waitTime = Timestamp.from(Instant.ofEpochMilli(waitedMillis)).toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("CHECK_LIST_WAIT", player, color))); if (current == null) { Message.sendPrefixless("CHECK_LIST_TO_CHECK", player, + waitTime, Message.parse("CHECK_LIST_TO_CHECK_HOVER", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check schematic " + schematic.getId()), schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName()); } else { Message.sendPrefixless("CHECK_LIST_CHECKING", player, + waitTime, Message.parse("CHECK_LIST_CHECKING_HOVER", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + current.checker.getName()), schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName(), current.checker.getName()); diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index d8b87bfe..59f28bc9 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -245,9 +245,10 @@ CHECK_HELP_NEXT=§8/§7check next §8- §7Nächste Prüffrage§8/§7freigeben CHECK_HELP_DECLINE=§8/§7check decline §8[§eGrund§8] - §7Schematic ablehnen CHECK_HELP_CANCEL=§8/§7check cancel §8- §7Bricht den Prüfvorgang ab CHECK_LIST_HEADER=§e§lZu prüfen sind {0} Schematics -CHECK_LIST_TO_CHECK=§8{0} §7{1} §e{2} +CHECK_LIST_TO_CHECK={0} §8{1} §7{2} §e{3} +CHECK_LIST_WAIT={0}d HH:mm CHECK_LIST_TO_CHECK_HOVER=§eSchematic prüfen -CHECK_LIST_CHECKING=§8{0} §7{1} §e{2} §7wird geprüft von §e{3} +CHECK_LIST_CHECKING={0} §8{1} §7{2} §e{3} §7wird geprüft von §e{4} CHECK_LIST_CHECKING_HOVER=§eZum Prüfer CHECK_SCHEMATIC_ALREADY_CHECKING=§cDu prüfst schon eine Schematic! CHECK_SCHEMATIC_OWN=§cDu kannst nicht deine eigenen Schematics prüfen.