diff --git a/varo/src/main/java/de/cliffbreak/varo/Varo.java b/varo/src/main/java/de/cliffbreak/varo/Varo.java index 5c420be..b91153c 100644 --- a/varo/src/main/java/de/cliffbreak/varo/Varo.java +++ b/varo/src/main/java/de/cliffbreak/varo/Varo.java @@ -50,7 +50,7 @@ public class Varo extends JavaPlugin { this.banUtils = new BanUtils(this); this.varoUtils = new VaroUtils(this); - this.config.addDefault("Varo.Start", "25.05.2020"); + this.config.addDefault("Varo.Start", 1590427800000f); this.config.addDefault("Varo.Debug", false); this.config.addDefault("Varo.RetroHealthRegen", false); this.config.addDefault("Varo.Bans", new ArrayList()); diff --git a/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerJoinQuitListener.java b/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerJoinQuitListener.java index e642b69..544367e 100644 --- a/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerJoinQuitListener.java +++ b/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerJoinQuitListener.java @@ -1,6 +1,10 @@ package de.cliffbreak.varo.listeners; -import java.util.Stack; +import java.time.Duration; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; import com.destroystokyo.paper.event.server.PaperServerListPingEvent; @@ -48,7 +52,6 @@ public class PlayerJoinQuitListener implements Listener { MessageUtils.getRichTextComponent(e.getPlayer().getName(), "§f hat den Server betreten.", true)); if (this.plugin.getConfig().getBoolean("Varo.Debug")) { - e.getPlayer().sendMessage("\n§7§l######### §9Cliffbreak.de - §lVaro §7§l#########\n \n" + " §cWarning: §r§c Plugin is running in DEBUG mode!\n "); } @@ -73,7 +76,17 @@ public class PlayerJoinQuitListener implements Listener { private void handlePaperServerListPing(final PaperServerListPingEvent e) { e.setHidePlayers(true); - // TODO: Add day counter - e.setMotd("§9§l" + "VARO" + "§b§l " + "Tag: -1" + "\n§r§7" + "powered by " + "§4" + "Cliffbreak.de"); + + try { + Instant instant = Instant.ofEpochMilli(this.plugin.getConfig().getLong("Varo.Start")); + LocalDateTime start = instant.atZone(ZoneId.systemDefault()).toLocalDateTime(); + final LocalDateTime current = LocalDateTime.now(); + + e.setMotd("§9§l" + "VARO" + "§b§l " + "Tag: " + (Duration.between(start, current).toDays() + 1) + "\n§r§7" + + "powered by " + "§4" + "Cliffbreak.de"); + } catch (Exception ex) { + ex.printStackTrace(); + e.setMotd("§9§l" + "VARO" + "§b§l " + "Tag: -1" + "\n§r§7" + "powered by " + "§4" + "Cliffbreak.de"); + } } } \ No newline at end of file