mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-23 15:29:34 +01:00
Always cleanup collideRule teams at startup
Fixes GH-463
This commit is contained in:
parent
da6e2f40a9
commit
f3fd0471f2
1 changed files with 7 additions and 1 deletions
|
@ -46,9 +46,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
this.l();
|
this.l();
|
||||||
+
|
+
|
||||||
+ // Paper start - Handle collideRule team for player collision toggle
|
+ // Paper start - Handle collideRule team for player collision toggle
|
||||||
|
+ final Scoreboard scoreboard = this.getWorld().getScoreboard();
|
||||||
|
+ final java.util.Collection<String> 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) {
|
+ if (!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions) {
|
||||||
+ this.getPlayerList().collideRuleTeamName = org.apache.commons.lang3.StringUtils.left("collideRule_" + this.getWorld().random.nextInt(), 16);
|
+ 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
|
+ collideTeam.setCanSeeFriendlyInvisibles(false); // Because we want to mimic them not being on a team at all
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
|
Loading…
Add table
Reference in a new issue