diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b37d7859..714229a99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,28 @@ If a change is missing, it is likely simple or was forgotten about when this log Feel free to PR corrections to this file. +## [0.6.1][0.6.1] + +### Added + +* None. + +### Changed + +* Bump com.github.spotbugs:spotbugs-annotations from 4.7.3 to 4.8.3 +* Bump org.apache.maven.plugins:maven-checkstyle-plugin from 3.3.0 to 3.3.1 +* Bump com.puppycrawl.tools:checkstyle from 10.12.4 to 10.12.7 +* Bump org.apache.maven.plugins:maven-surefire-plugin from 3.1.2 to 3.2.5 +* Bump org.apache.maven.plugins:maven-failsafe-plugin from 3.1.2 to 3.2.5 + +### Fixed + +- Fix scheduler not running properly for flags. + +### Removed + +- None + ## [0.6.0][0.6.0] ### Added diff --git a/pom.xml b/pom.xml index c25ec2cc2..29f08da74 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ io.github.townyadvanced.flagwar FlagWar jar - 0.6.0 + 0.6.1 An OG war system for TownyAdvanced. Celebrating a decade of Flag-based Towny Warfare. diff --git a/src/main/java/io/github/townyadvanced/flagwar/listeners/FlagWarCustomListener.java b/src/main/java/io/github/townyadvanced/flagwar/listeners/FlagWarCustomListener.java index 7b9b0c7de..3efd1169e 100644 --- a/src/main/java/io/github/townyadvanced/flagwar/listeners/FlagWarCustomListener.java +++ b/src/main/java/io/github/townyadvanced/flagwar/listeners/FlagWarCustomListener.java @@ -89,7 +89,7 @@ public FlagWarCustomListener(final FlagWar flagWar) { * {@link FlagWar#registerAttack(CellUnderAttack)} using the cell from the CellAttackEvent. * @param cellAttackEvent the associated CellAttackEvent. */ - @EventHandler(priority = EventPriority.LOWEST) + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @SuppressWarnings("unused") public void onCellAttackEvent(final CellAttackEvent cellAttackEvent) { if (cellAttackEvent.isCancelled()) { diff --git a/src/main/java/io/github/townyadvanced/flagwar/objects/CellUnderAttack.java b/src/main/java/io/github/townyadvanced/flagwar/objects/CellUnderAttack.java index fe63ffc24..5ec7aacc3 100644 --- a/src/main/java/io/github/townyadvanced/flagwar/objects/CellUnderAttack.java +++ b/src/main/java/io/github/townyadvanced/flagwar/objects/CellUnderAttack.java @@ -21,7 +21,6 @@ import com.gmail.filoghost.holographicdisplays.api.HologramsAPI; import com.gmail.filoghost.holographicdisplays.api.line.TextLine; import com.palmergames.bukkit.towny.object.Coord; -import com.palmergames.bukkit.towny.scheduling.ScheduledTask; import com.palmergames.bukkit.towny.scheduling.TaskScheduler; import io.github.townyadvanced.flagwar.CellAttackThread; @@ -69,9 +68,9 @@ public class CellUnderAttack extends Cell { /** Identifies the phase the war flag is in. **/ private int flagPhaseID; /** A thread used to update the state of the {@link CellUnderAttack} using the Scheduler's repeating task.*/ - private ScheduledTask thread; + private CellAttackThread thread; /** A thread used to update the {@link #hologram}'s {@link #timerLine}. */ - private ScheduledTask hologramThread; + private HologramUpdateThread hologramThread; /** Holds the war flag hologram. */ private Hologram hologram; /** Holds the time, in seconds, assuming 20 ticks is 1 second, of the war flag. */ @@ -99,6 +98,8 @@ public CellUnderAttack(final String flagOwner, final Block base, final Duration this.flagLightBlock = world.getBlockAt(base.getX(), base.getY() + 2, base.getZ()); this.flagPhaseDuration = timerPhase; + this.thread = new CellAttackThread(this); + this.hologramThread = new HologramUpdateThread(this); } /** @return if {@link CellUnderAttack} equals a given {@link Object}. (Defers to {@link Cell#equals(Object)}.) */ @@ -360,11 +361,11 @@ public void beginAttack() { final int tps = 20; final int milliTicks = 50; final long ticksFromMs = this.flagPhaseDuration.toMillis() / milliTicks; - thread = scheduler.runRepeating(() -> new CellAttackThread(this), ticksFromMs, ticksFromMs); + scheduler.runRepeating(() -> thread.run(), ticksFromMs, ticksFromMs); if (FlagWarConfig.isHologramEnabled()) { drawHologram(); if (FlagWarConfig.hasTimerLine()) { - hologramThread = scheduler.runRepeating(() -> new HologramUpdateThread(this), tps, tps); + scheduler.runRepeating(() -> hologramThread.run(), tps, tps); } } }