forked from SteamWar/SteamWar
Update CustomMap
This commit is contained in:
@@ -80,9 +80,12 @@ public class CustomMap implements Listener {
|
||||
|
||||
if (mapFileOrDirectory.isDirectory()) {
|
||||
AtomicReference<Month> lastMonth = new AtomicReference<>(LocalDateTime.now().getMonth());
|
||||
AtomicReference<Long> 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");
|
||||
|
||||
Reference in New Issue
Block a user