mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Further safety for player collision setting
Hopefully the end of similar problems Fixes GH-415
This commit is contained in:
parent
098dae2524
commit
b0a15ca1ea
1 changed files with 10 additions and 7 deletions
|
@ -66,8 +66,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
entityplayer.syncInventory();
|
entityplayer.syncInventory();
|
||||||
+ // Paper start - Add to collideRule team if needed
|
+ // Paper start - Add to collideRule team if needed
|
||||||
+ if (this.collideRuleTeamName != null) {
|
+ final Scoreboard scoreboard = this.getServer().getWorld().getScoreboard();
|
||||||
+ this.server.getWorld().getScoreboard().addPlayerToTeam(entityplayer.getName(), collideRuleTeamName);
|
+ if (this.collideRuleTeamName != null && scoreboard.getTeam(collideRuleTeamName) != null && entityplayer.getTeam() == null) {
|
||||||
|
+ scoreboard.addPlayerToTeam(entityplayer.getName(), collideRuleTeamName);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
// CraftBukkit - Moved from above, added world
|
// CraftBukkit - Moved from above, added world
|
||||||
|
@ -79,9 +80,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
+ // Paper start - Remove from collideRule team if needed
|
+ // Paper start - Remove from collideRule team if needed
|
||||||
+ if (this.collideRuleTeamName != null) {
|
+ if (this.collideRuleTeamName != null) {
|
||||||
+ Scoreboard scoreBoard = this.server.getWorld().getScoreboard();
|
+ final Scoreboard scoreBoard = this.server.getWorld().getScoreboard();
|
||||||
+ ScoreboardTeam team = scoreBoard.getTeam(this.collideRuleTeamName);
|
+ final ScoreboardTeam team = scoreBoard.getTeam(this.collideRuleTeamName);
|
||||||
+ if (team != null) scoreBoard.removePlayerFromTeam(entityplayer.getName(), team);
|
+ if (entityplayer.getTeam() == team && team != null) {
|
||||||
|
+ scoreBoard.removePlayerFromTeam(entityplayer.getName(), team);
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+
|
+
|
||||||
|
@ -95,8 +98,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
-
|
-
|
||||||
+ // Paper start - Remove collideRule team if it exists
|
+ // Paper start - Remove collideRule team if it exists
|
||||||
+ if (this.collideRuleTeamName != null) {
|
+ if (this.collideRuleTeamName != null) {
|
||||||
+ Scoreboard scoreboard = this.getServer().getWorld().getScoreboard();
|
+ final Scoreboard scoreboard = this.getServer().getWorld().getScoreboard();
|
||||||
+ ScoreboardTeam team = scoreboard.getTeam(this.collideRuleTeamName);
|
+ final ScoreboardTeam team = scoreboard.getTeam(this.collideRuleTeamName);
|
||||||
+ if (team != null) scoreboard.removeTeam(team);
|
+ if (team != null) scoreboard.removeTeam(team);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
|
Loading…
Reference in a new issue