Skip to content

Commit

Permalink
Fix match not cancelling on initial leave
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablete1234 committed Mar 31, 2021
1 parent 4af4bdb commit 5866562
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/main/java/rip/bolt/ingame/ranked/PlayerWatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import tc.oc.pgm.events.PlayerJoinMatchEvent;
import tc.oc.pgm.events.PlayerPartyChangeEvent;
import tc.oc.pgm.lib.net.kyori.adventure.text.format.NamedTextColor;
import tc.oc.pgm.result.TieVictoryCondition;

public class PlayerWatcher implements Listener {

Expand Down Expand Up @@ -115,13 +116,14 @@ public void onMatchEndMonitor(MatchFinishEvent event) {
forfeitManager.clearCheckers();
}

@EventHandler(priority = EventPriority.MONITOR)
@EventHandler(priority = EventPriority.HIGHEST)
public void onMatchStart(MatchStartEvent event) {
if (!AppData.fullTeamsRequired()) return;
if (!playersAbandoned(getMissingPlayers(event.getMatch()))) return;

// the order of these two lines should not be changed
rankedManager.postMatchStatus(event.getMatch(), MatchStatus.CANCELLED);
event.getMatch().addVictoryCondition(new TieVictoryCondition());
event.getMatch().finish();

event
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/rip/bolt/ingame/ranked/RankedManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import rip.bolt.ingame.Ingame;
import rip.bolt.ingame.api.definitions.BoltMatch;
Expand Down Expand Up @@ -171,7 +172,7 @@ public void onMatchLoad(MatchLoadEvent event) {
postMatchStatus(event.getMatch(), MatchStatus.LOADED);
}

@EventHandler
@EventHandler(priority = EventPriority.MONITOR)
public void onMatchStart(MatchStartEvent event) {
postMatchStatus(event.getMatch(), MatchStatus.STARTED);
}
Expand Down

0 comments on commit 5866562

Please sign in to comment.