mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 17:07:34 +01:00
Create a team as needed for disabling collisions
Fixes GH-383
This commit is contained in:
parent
eb7e4424fa
commit
d26051ef63
@ -1,11 +1,11 @@
|
||||
From be7abd3e82e2f0c81e607b6ea382fd6fd21dd897 Mon Sep 17 00:00:00 2001
|
||||
From df938c2cb1bb037fdddd539367bfb658a79809a1 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 13 Apr 2016 02:10:49 -0400
|
||||
Subject: [PATCH] Configurable Player Collision
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 22c7dea..24fb01c 100644
|
||||
index 17c05f8..d9d8904 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -218,4 +218,9 @@ public class PaperConfig {
|
||||
@ -18,6 +18,37 @@ index 22c7dea..24fb01c 100644
|
||||
+ enablePlayerCollisions = getBoolean("settings.enable-player-collisions", true);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 8e364de..544d601 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -324,6 +324,13 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||
this.v.setPlayerFileData(this.worldServer);
|
||||
this.a(this.getDifficulty());
|
||||
this.l();
|
||||
+
|
||||
+ // Paper start - Handle collideRule team for player collision toggle
|
||||
+ if (!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions) {
|
||||
+ this.getPlayerList().collideRuleTeamName = org.apache.commons.lang3.StringUtils.left("collideRule_" + this.getWorld().random.nextInt(), 16);
|
||||
+ this.getWorld().getScoreboard().createTeam(this.getPlayerList().collideRuleTeamName);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
protected void l() {
|
||||
@@ -444,6 +451,12 @@ 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 d8ec504..eb45d3c 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java
|
||||
@ -31,6 +62,44 @@ index d8ec504..eb45d3c 100644
|
||||
packetdataserializer.writeByte(this.g);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index a41bc5f..606f022 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -67,6 +67,7 @@ public abstract class PlayerList {
|
||||
// CraftBukkit start
|
||||
private CraftServer cserver;
|
||||
private final Map<String,EntityPlayer> playersByName = new org.spigotmc.CaseInsensitiveMap<EntityPlayer>();
|
||||
+ @Nullable String collideRuleTeamName; // Paper - Team name used for collideRule
|
||||
|
||||
public PlayerList(MinecraftServer minecraftserver) {
|
||||
this.cserver = minecraftserver.server = new CraftServer(minecraftserver, this);
|
||||
@@ -234,6 +235,11 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
entityplayer.syncInventory();
|
||||
+ // Paper start - Add to collideRule team if needed
|
||||
+ if (this.collideRuleTeamName != null) {
|
||||
+ this.server.getWorld().getScoreboard().addPlayerToTeam(entityplayer.getName(), collideRuleTeamName);
|
||||
+ }
|
||||
+ // Paper end
|
||||
// CraftBukkit - Moved from above, added world
|
||||
PlayerList.f.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at ([" + entityplayer.world.worldData.getName() + "]" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
|
||||
}
|
||||
@@ -404,6 +410,13 @@ public abstract class PlayerList {
|
||||
entityplayer.k_();// SPIGOT-924 // PAIL: rename - playerTick
|
||||
// CraftBukkit end
|
||||
|
||||
+ // 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));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
this.savePlayerFile(entityplayer);
|
||||
if (entityplayer.isPassenger()) {
|
||||
Entity entity = entityplayer.getVehicle();
|
||||
--
|
||||
2.9.3
|
||||
2.10.0.windows.1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 945260041266024d159b4dd1cfd561f531cfbc0b Mon Sep 17 00:00:00 2001
|
||||
From 4acc11dbab4d03e506392d6457501c23d5c11b81 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 28 Apr 2016 00:57:27 -0400
|
||||
Subject: [PATCH] remove null possibility for getServer singleton
|
||||
@ -6,7 +6,7 @@ Subject: [PATCH] remove null possibility for getServer singleton
|
||||
to stop IDE complaining about potential NPE
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 1a7a0ee..5de3672 100644
|
||||
index 544d601..4f7269b 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -49,6 +49,7 @@ import co.aikar.timings.MinecraftTimings; // Paper
|
||||
@ -25,7 +25,7 @@ index 1a7a0ee..5de3672 100644
|
||||
io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable
|
||||
this.e = proxy;
|
||||
this.U = yggdrasilauthenticationservice;
|
||||
@@ -1597,7 +1599,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||
@@ -1610,7 +1612,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||
// CraftBukkit start
|
||||
@Deprecated
|
||||
public static MinecraftServer getServer() {
|
||||
@ -35,5 +35,5 @@ index 1a7a0ee..5de3672 100644
|
||||
// CraftBukkit end
|
||||
}
|
||||
--
|
||||
2.9.2.windows.1
|
||||
2.10.0.windows.1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 856fdc306af6b8978ac1086ac714b72791646461 Mon Sep 17 00:00:00 2001
|
||||
From a6f002341c7de438b7205c77af63fe64c0145e55 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 16 May 2016 20:47:41 -0400
|
||||
Subject: [PATCH] Optimize UserCache / Thread Safe
|
||||
@ -10,10 +10,10 @@ Additionally, move Saving of the User cache to be done async, incase
|
||||
the user never changed the default setting for Spigot's save on stop only.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 5de3672..0daf784 100644
|
||||
index 4f7269b..04da697 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -500,7 +500,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||
@@ -513,7 +513,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||
// Spigot start
|
||||
if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
|
||||
LOGGER.info("Saving usercache.json");
|
||||
@ -96,5 +96,5 @@ index ccfc755..989758c 100644
|
||||
}
|
||||
|
||||
--
|
||||
2.9.2.windows.1
|
||||
2.10.0.windows.1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user