From 8b09e54106a942943cf1a0a93a14bca78e205c40 Mon Sep 17 00:00:00 2001 From: Teriuihi Date: Tue, 11 Feb 2025 23:02:38 +0100 Subject: [PATCH] Fix flag capture and game phase timing bugs Adjusted the flag capture sequence to ensure proper update of the carrier before notifying about the capture. Fixed the phaseStartTime initialization to correctly track phase transitions. Updated the build number for the new changes. --- src/main/java/com/alttd/ctf/flag/Flag.java | 2 +- src/main/java/com/alttd/ctf/game/RunningGame.java | 2 +- version.properties | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/alttd/ctf/flag/Flag.java b/src/main/java/com/alttd/ctf/flag/Flag.java index b7e1783..ab40d09 100644 --- a/src/main/java/com/alttd/ctf/flag/Flag.java +++ b/src/main/java/com/alttd/ctf/flag/Flag.java @@ -81,8 +81,8 @@ public class Flag implements Runnable { //TODO add de-buffs and enable buffs for others? player.getInventory().setItem(EquipmentSlot.HEAD, flagItem); Bukkit.getScheduler().runTask(main, () -> flagLocation.getBlock().setType(Material.AIR)); - notifyAboutCapture(); flagCarrier = player; + notifyAboutCapture(); resetFlag(); } diff --git a/src/main/java/com/alttd/ctf/game/RunningGame.java b/src/main/java/com/alttd/ctf/game/RunningGame.java index 23028d3..8279c94 100644 --- a/src/main/java/com/alttd/ctf/game/RunningGame.java +++ b/src/main/java/com/alttd/ctf/game/RunningGame.java @@ -39,7 +39,6 @@ public class RunningGame implements Runnable { try { GamePhase nextPhase = (currentPhase.ordinal() + 1 < GamePhase.values().length) ? GamePhase.values()[currentPhase.ordinal() + 1] : null; if (phaseStartTime == null) { - phaseStartTime = Instant.now(); nextPhaseActions(null, currentPhase); } @@ -60,6 +59,7 @@ public class RunningGame implements Runnable { private void nextPhaseActions(@Nullable GamePhase previousPhase, @NotNull GamePhase phase) { //TODO command to go to next phase this.currentPhase = phase; + this.phaseStartTime = Instant.now(); if (previousPhase != null) { gameManager.getPhaseExecutor(previousPhase).end(phase); } diff --git a/version.properties b/version.properties index 7a221ff..e0fff57 100644 --- a/version.properties +++ b/version.properties @@ -1,3 +1,3 @@ -#Tue Feb 11 22:04:16 CET 2025 -buildNumber=42 +#Tue Feb 11 22:21:13 CET 2025 +buildNumber=45 version=0.1