From 105eda32e66077119f3d75a22157dbffd0ada8c4 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Sun, 30 Aug 2026 12:15:22 +0200 Subject: [PATCH] Update CustomMap --- LobbySystem/src/de/steamwar/lobby/map/CustomMap.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/LobbySystem/src/de/steamwar/lobby/map/CustomMap.java b/LobbySystem/src/de/steamwar/lobby/map/CustomMap.java index aaa0ca63..5dd478a7 100644 --- a/LobbySystem/src/de/steamwar/lobby/map/CustomMap.java +++ b/LobbySystem/src/de/steamwar/lobby/map/CustomMap.java @@ -80,9 +80,12 @@ public class CustomMap implements Listener { if (mapFileOrDirectory.isDirectory()) { AtomicReference lastMonth = new AtomicReference<>(LocalDateTime.now().getMonth()); + AtomicReference lastModified = new AtomicReference<>(Long.MAX_VALUE); Bukkit.getScheduler().runTaskTimer(LobbySystem.getInstance(), () -> { + long modified = mapFileOrDirectory.lastModified(); Month current = LocalDateTime.now().getMonth(); - if (!current.equals(lastMonth.get()) || update) { + if (modified > lastModified.get() || !current.equals(lastMonth.get()) || update) { + lastModified.set(modified); lastMonth.set(current); update = false; this.mapFile = new File(mapFileOrDirectory, current.getValue() + ".png");