diff --git a/Challenge/src/main/java/de/fanta/challenge/challenges/ChallengeEvents/DeathrunChallengeEventMonth.java b/Challenge/src/main/java/de/fanta/challenge/challenges/ChallengeEvents/DeathrunChallengeEventMonth.java index 6519400..9b37d77 100644 --- a/Challenge/src/main/java/de/fanta/challenge/challenges/ChallengeEvents/DeathrunChallengeEventMonth.java +++ b/Challenge/src/main/java/de/fanta/challenge/challenges/ChallengeEvents/DeathrunChallengeEventMonth.java @@ -57,6 +57,7 @@ import java.io.IOException; import java.text.SimpleDateFormat; import java.time.LocalDateTime; +import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Calendar; @@ -67,7 +68,7 @@ import java.util.Objects; import java.util.Optional; import java.util.Random; -import java.util.Set; +import java.util.TimeZone; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; @@ -650,7 +651,8 @@ private void rollBackBlocks() { SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); - Calendar calendar = Calendar.getInstance(); + sdf.setTimeZone(TimeZone.getTimeZone("Europe/Berlin")); + Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("Europe/Berlin")); calendar.add(Calendar.HOUR_OF_DAY, -6); calendar.add(Calendar.MINUTE, -2); @@ -660,14 +662,15 @@ String before = sdf.format(calendar.getTime()); String command = String.format("lb rb silent world world since %s before %s", since, before); - plugin.getLogger().info("RB Blocks: " + command); Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command); } + private void rollBackEntities() { SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); - Calendar calendar = Calendar.getInstance(); + sdf.setTimeZone(TimeZone.getTimeZone("Europe/Berlin")); + Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("Europe/Berlin")); calendar.add(Calendar.HOUR_OF_DAY, -1); calendar.add(Calendar.MINUTE, -2); @@ -677,7 +680,6 @@ String before = sdf.format(calendar.getTime()); String command = String.format("lb rb entity silent world world since %s before %s", since, before); - plugin.getLogger().info("RB Entities: " + command); Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command); } @@ -735,7 +737,8 @@ private static void logToFile(String fileName, String logMessage) { DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm:ss"); - String timestamp = LocalDateTime.now().format(dateTimeFormatter); + LocalDateTime now = LocalDateTime.now(ZoneId.of("Europe/Berlin")); + String timestamp = now.format(dateTimeFormatter); File logDir = new File(plugin.getDataFolder(), "logs"); if (!logDir.exists()) {