From f3fd0471f2285599c06d27808dce27f554705a4c Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> Date: Sat, 5 Nov 2016 13:34:18 -0500 Subject: [PATCH] Always cleanup collideRule teams at startup Fixes GH-463 --- Spigot-Server-Patches/Configurable-Player-Collision.patch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Spigot-Server-Patches/Configurable-Player-Collision.patch b/Spigot-Server-Patches/Configurable-Player-Collision.patch index 83ee2c821a..5324b70a01 100644 --- a/Spigot-Server-Patches/Configurable-Player-Collision.patch +++ b/Spigot-Server-Patches/Configurable-Player-Collision.patch @@ -46,9 +46,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.l(); + + // Paper start - Handle collideRule team for player collision toggle ++ final Scoreboard scoreboard = this.getWorld().getScoreboard(); ++ final java.util.Collection toRemove = scoreboard.getTeams().stream().filter(team -> team.getName().startsWith("collideRule_")).map(ScoreboardTeam::getName).collect(java.util.stream.Collectors.toList()); ++ for (String teamName : toRemove) { ++ scoreboard.removeTeam(scoreboard.getTeam(teamName)); // Clean up after ourselves ++ } ++ + if (!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions) { + this.getPlayerList().collideRuleTeamName = org.apache.commons.lang3.StringUtils.left("collideRule_" + this.getWorld().random.nextInt(), 16); -+ ScoreboardTeam collideTeam = this.getWorld().getScoreboard().createTeam(this.getPlayerList().collideRuleTeamName); ++ ScoreboardTeam collideTeam = scoreboard.createTeam(this.getPlayerList().collideRuleTeamName); + collideTeam.setCanSeeFriendlyInvisibles(false); // Because we want to mimic them not being on a team at all + } + // Paper end