From b0209dcd129493d133210192e489c4fb048fc0d7 Mon Sep 17 00:00:00 2001 From: Matheus Date: Fri, 14 Jun 2024 08:01:32 -0400 Subject: [PATCH] fixes to matches (i think) --- src/main/java/land/battle/practice/managers/MatchManager.java | 2 +- .../java/land/battle/practice/runnable/MatchRunnable.java | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/land/battle/practice/managers/MatchManager.java b/src/main/java/land/battle/practice/managers/MatchManager.java index d75a260..8ba622c 100644 --- a/src/main/java/land/battle/practice/managers/MatchManager.java +++ b/src/main/java/land/battle/practice/managers/MatchManager.java @@ -390,7 +390,7 @@ public class MatchManager { match.broadcast(player.getDisplayName() + Color.SECONDARY_COLOR + " is no longer spectating your match."); } - match.getTeamByPlayer(player.getUniqueId()).getPlayers().remove(player.getUniqueId()); + if (match.getTeamByPlayer(player.getUniqueId()) != null) match.getTeamByPlayer(player.getUniqueId()).getPlayers().remove(player.getUniqueId()); this.spectators.remove(player.getUniqueId()); this.plugin.getPlayerManager().sendToSpawnAndReset(player); } diff --git a/src/main/java/land/battle/practice/runnable/MatchRunnable.java b/src/main/java/land/battle/practice/runnable/MatchRunnable.java index 87ef784..34d3bdf 100644 --- a/src/main/java/land/battle/practice/runnable/MatchRunnable.java +++ b/src/main/java/land/battle/practice/runnable/MatchRunnable.java @@ -90,9 +90,7 @@ public class MatchRunnable extends BukkitRunnable { this.match.getEntitiesToRemove().forEach(Entity::remove); this.match.getTeams().forEach(team -> team.streamAlivePlayers().forEach(this.plugin.getPlayerManager()::sendToSpawnAndUpdateTag)); - this.match.streamSpectators().forEach(player -> { - this.plugin.getMatchManager().removeSpectator(player, true); - }); + this.match.streamSpectators().forEach(player -> this.plugin.getMatchManager().removeSpectator(player, true)); this.match.getPlacedBlockLocations().forEach(location -> location.getBlock().setType(Material.AIR)); this.match.getOriginalBlockChanges().forEach(blockState -> blockState.getLocation().getBlock().setType(blockState.getType()));