fixes to matches (i think)

This commit is contained in:
Matheus 2024-06-14 08:01:32 -04:00
parent 7e1ac481ba
commit b0209dcd12
2 changed files with 2 additions and 4 deletions

View File

@ -390,7 +390,7 @@ public class MatchManager {
match.broadcast(player.getDisplayName() + Color.SECONDARY_COLOR + " is no longer spectating your match."); 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.spectators.remove(player.getUniqueId());
this.plugin.getPlayerManager().sendToSpawnAndReset(player); this.plugin.getPlayerManager().sendToSpawnAndReset(player);
} }

View File

@ -90,9 +90,7 @@ public class MatchRunnable extends BukkitRunnable {
this.match.getEntitiesToRemove().forEach(Entity::remove); this.match.getEntitiesToRemove().forEach(Entity::remove);
this.match.getTeams().forEach(team -> this.match.getTeams().forEach(team ->
team.streamAlivePlayers().forEach(this.plugin.getPlayerManager()::sendToSpawnAndUpdateTag)); team.streamAlivePlayers().forEach(this.plugin.getPlayerManager()::sendToSpawnAndUpdateTag));
this.match.streamSpectators().forEach(player -> { this.match.streamSpectators().forEach(player -> this.plugin.getMatchManager().removeSpectator(player, true));
this.plugin.getMatchManager().removeSpectator(player, true);
});
this.match.getPlacedBlockLocations().forEach(location -> location.getBlock().setType(Material.AIR)); this.match.getPlacedBlockLocations().forEach(location -> location.getBlock().setType(Material.AIR));
this.match.getOriginalBlockChanges().forEach(blockState -> blockState.getLocation().getBlock().setType(blockState.getType())); this.match.getOriginalBlockChanges().forEach(blockState -> blockState.getLocation().getBlock().setType(blockState.getType()));