mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-10 12:50:28 +01:00
7c640a1ae2
* fixup patch and rebuild * Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: bde198c9 SPIGOT-5246: PlayerQuitEvent.get/setQuitMessage() is incorrectly marked as NotNull 24ad5a79 SPIGOT-5240: Vector.angle not valid for angles very close to each other a143db9a SPIGOT-5231: ShotAtAngle API for Fireworks 10db5c3d SPIGOT-5226: Update Javadoc of PlayerDeathEvent CraftBukkit Changes:1ec1b05e
SPIGOT-5245: Unneeded cast to WorldNBTStorage in CraftWorld#getWorldFoldere5e8eec2
SPIGOT-5241: setAttributeModifiers does not work on untouched stack803eaa31
SPIGOT-5231: ShotAtAngle API for Fireworks7881d2ae
SPIGOT-5237: Horses, pigs do not drop their inventory06efc9ec
Don't accept connections until all plugins have enabledda62a66a
SPIGOT-5225: World handle isn't closed if world is unloaded without saving104b3831
SPIGOT-5222: Cannot get Long values from Entity memoryf0b3fe43
SPIGOT-5220: Server CPU usage reaches 100% when stdin is null Spigot Changes: e5b1b5db SPIGOT-5235: Destroy expired area effect clouds / fireworks that are inactive cbcc8e87 Make region files more reliable to write to 8887c5f4 Remove redundant late-bind option dac29063 Rebuild patches * Preserve old flush on save flag for reliable regionfiles Originally this patch was in paper * Fix some issues with the death event - Entities potentially entering a glitched state to the client where they appear to be falling over - Donkeys losing their chest if the event was cancelled (only an issue since the upstream merge) - Some wither death logic running for an entity killed by a wither
120 lines
6.6 KiB
Diff
120 lines
6.6 KiB
Diff
From ad70f23c1ea684f7771bb2b748da2103093c3711 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 0cef1853f5..dc3438890b 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
@@ -223,4 +223,9 @@ public class PaperConfig {
|
|
private static void regionFileCacheSize() {
|
|
regionFileCacheSize = Math.max(getInt("settings.region-file-cache-size", 256), 4);
|
|
}
|
|
+
|
|
+ public static boolean enablePlayerCollisions = true;
|
|
+ private static void enablePlayerCollisions() {
|
|
+ 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 fe50d4ff71..e3bd80c934 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -446,6 +446,20 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
|
|
}
|
|
|
|
+ // Paper start - Handle collideRule team for player collision toggle
|
|
+ final Scoreboard scoreboard = this.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) {
|
|
+ this.getPlayerList().collideRuleTeamName = org.apache.commons.lang3.StringUtils.left("collideRule_" + java.util.concurrent.ThreadLocalRandom.current().nextInt(), 16);
|
|
+ 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
|
|
+
|
|
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
|
|
this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
|
|
this.serverConnection.acceptConnections();
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java
|
|
index b0740965a4..6b1a914d2f 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java
|
|
@@ -96,7 +96,7 @@ public class PacketPlayOutScoreboardTeam implements Packet<PacketListenerPlayOut
|
|
packetdataserializer.a(this.b);
|
|
packetdataserializer.writeByte(this.j);
|
|
packetdataserializer.a(this.e);
|
|
- packetdataserializer.a(this.f);
|
|
+ packetdataserializer.a(!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions ? "never" : this.f); // Paper
|
|
packetdataserializer.a((Enum) this.g);
|
|
packetdataserializer.a(this.c);
|
|
packetdataserializer.a(this.d);
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
|
index d368b39751..ee5297dc38 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
|
@@ -72,6 +72,7 @@ public abstract class PlayerList {
|
|
// CraftBukkit start
|
|
private CraftServer cserver;
|
|
private final Map<String,EntityPlayer> playersByName = new java.util.HashMap<>();
|
|
+ @Nullable String collideRuleTeamName; // Paper - Team name used for collideRule
|
|
|
|
public PlayerList(MinecraftServer minecraftserver, int i) {
|
|
this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this);
|
|
@@ -286,6 +287,13 @@ public abstract class PlayerList {
|
|
}
|
|
|
|
entityplayer.syncInventory();
|
|
+ // Paper start - Add to collideRule team if needed
|
|
+ final Scoreboard scoreboard = this.getServer().getWorldServer(DimensionManager.OVERWORLD).getScoreboard();
|
|
+ final ScoreboardTeam collideRuleTeam = scoreboard.getTeam(collideRuleTeamName);
|
|
+ if (this.collideRuleTeamName != null && collideRuleTeam != null && entityplayer.getScoreboardTeam() == null) {
|
|
+ scoreboard.addPlayerToTeam(entityplayer.getName(), collideRuleTeam);
|
|
+ }
|
|
+ // Paper end
|
|
// CraftBukkit - Moved from above, added world
|
|
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.world.worldData.getName(), entityplayer.locX, entityplayer.locY, entityplayer.locZ);
|
|
}
|
|
@@ -404,6 +412,16 @@ public abstract class PlayerList {
|
|
entityplayer.playerTick();// SPIGOT-924
|
|
// CraftBukkit end
|
|
|
|
+ // Paper start - Remove from collideRule team if needed
|
|
+ if (this.collideRuleTeamName != null) {
|
|
+ final Scoreboard scoreBoard = this.server.getWorldServer(DimensionManager.OVERWORLD).getScoreboard();
|
|
+ final ScoreboardTeam team = scoreBoard.getTeam(this.collideRuleTeamName);
|
|
+ if (entityplayer.getScoreboardTeam() == team && team != null) {
|
|
+ scoreBoard.removePlayerFromTeam(entityplayer.getName(), team);
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
this.savePlayerFile(entityplayer);
|
|
if (entityplayer.isPassenger()) {
|
|
Entity entity = entityplayer.getRootVehicle();
|
|
@@ -1027,7 +1045,13 @@ 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) {
|
|
+ final Scoreboard scoreboard = this.getServer().getWorldServer(DimensionManager.OVERWORLD).getScoreboard();
|
|
+ final ScoreboardTeam team = scoreboard.getTeam(this.collideRuleTeamName);
|
|
+ if (team != null) scoreboard.removeTeam(team);
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
// CraftBukkit start
|
|
--
|
|
2.22.0
|
|
|