From 6dedb92652dad681d76560c273b066e3bdfa1d80 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> Date: Tue, 6 Sep 2016 12:33:47 -0500 Subject: [PATCH] Make collide team removal more patient, safer Fixes GH-414 --- .../Configurable-Player-Collision.patch | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/Spigot-Server-Patches/Configurable-Player-Collision.patch b/Spigot-Server-Patches/Configurable-Player-Collision.patch index d45e7101f8..a66b26996f 100644 --- a/Spigot-Server-Patches/Configurable-Player-Collision.patch +++ b/Spigot-Server-Patches/Configurable-Player-Collision.patch @@ -36,19 +36,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } protected void l() { -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - hasStopped = true; - } - // CraftBukkit end -+ // Paper start - Remove collideRule team if it exists -+ if (this.getPlayerList().collideRuleTeamName != null) { -+ ScoreboardTeam team = this.getWorld().getScoreboard().getTeam(this.getPlayerList().collideRuleTeamName); -+ this.getWorld().scoreboard.removeTeam(team); -+ } -+ // Paper end - MinecraftServer.LOGGER.info("Stopping server"); - MinecraftTimings.stopServer(); // Paper - // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java @@ -93,11 +80,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - Remove from collideRule team if needed + if (this.collideRuleTeamName != null) { + Scoreboard scoreBoard = this.server.getWorld().getScoreboard(); -+ scoreBoard.removePlayerFromTeam(entityplayer.getName(), scoreBoard.getTeam(collideRuleTeamName)); ++ ScoreboardTeam team = scoreBoard.getTeam(this.collideRuleTeamName); ++ if (team != null) scoreBoard.removePlayerFromTeam(entityplayer.getName(), team); + } + // Paper end + this.savePlayerFile(entityplayer); if (entityplayer.isPassenger()) { Entity entity = entityplayer.getVehicle(); +@@ -0,0 +0,0 @@ public abstract class PlayerList { + player.playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message + } + // CraftBukkit end +- ++ // Paper start - Remove collideRule team if it exists ++ if (this.collideRuleTeamName != null) { ++ Scoreboard scoreboard = this.getServer().getWorld().getScoreboard(); ++ ScoreboardTeam team = scoreboard.getTeam(this.collideRuleTeamName); ++ if (team != null) scoreboard.removeTeam(team); ++ } ++ // Paper end + } + + // CraftBukkit start -- \ No newline at end of file