2020-05-06 17:48:49 +08:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2020-04-10 09:22:21 +08:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Thu, 9 Apr 2020 21:20:33 -0400
|
|
|
|
Subject: [PATCH] Don't move existing players to world spawn
|
|
|
|
|
|
|
|
This can cause a nasty server lag the spawn chunks are not kept loaded
|
|
|
|
or they aren't finished loading yet, or if the world spawn radius is
|
|
|
|
larger than the keep loaded range.
|
|
|
|
|
|
|
|
By skipping this, we avoid potential for a large spike on server start.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
2020-06-02 11:15:47 +08:00
|
|
|
index f4215d38acef8018f09dff5f379c14336647687d..4e4c0acc6c103c85b7ba2a390a54d3513939d547 100644
|
2020-04-10 09:22:21 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
2020-05-06 15:44:47 +08:00
|
|
|
@@ -114,7 +114,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2020-04-10 09:22:21 +08:00
|
|
|
this.serverStatisticManager = minecraftserver.getPlayerList().getStatisticManager(this);
|
|
|
|
this.advancementDataPlayer = minecraftserver.getPlayerList().f(this);
|
|
|
|
this.H = 1.0F;
|
|
|
|
- this.a(worldserver);
|
|
|
|
+ //this.a(worldserver); // Paper - don't move to spawn on login, only first join
|
|
|
|
|
|
|
|
this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
|
|
|
|
|
2020-05-06 15:44:47 +08:00
|
|
|
@@ -162,6 +162,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2020-04-10 09:22:21 +08:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
+ public void moveToSpawn(WorldServer worldserver) { a(worldserver); } // Paper - OBFHELPER
|
|
|
|
private void a(WorldServer worldserver) {
|
|
|
|
BlockPosition blockposition = worldserver.getSpawn();
|
|
|
|
|
2020-05-06 15:44:47 +08:00
|
|
|
@@ -302,7 +303,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2020-04-19 15:11:02 +08:00
|
|
|
position = new Vec3D(world.getSpawn());
|
|
|
|
}
|
|
|
|
this.world = world;
|
|
|
|
- this.setPosition(position.getX(), position.getY(), position.getZ());
|
|
|
|
+ this.setPositionRaw(position.getX(), position.getY(), position.getZ()); // Paper - don't register to chunks yet
|
|
|
|
}
|
|
|
|
this.dimension = ((WorldServer) this.world).getWorldProvider().getDimensionManager();
|
|
|
|
this.playerInteractManager.a((WorldServer) world);
|
2020-04-10 09:22:21 +08:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
2020-06-02 11:15:47 +08:00
|
|
|
index 32d8cc7f22aaddef2e68506eeb44e01795f2aff5..ab2831830ad3a4cec0671d189e0534c843b47f5e 100644
|
2020-04-10 09:22:21 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
|
|
|
@@ -108,6 +108,7 @@ public abstract class PlayerList {
|
|
|
|
NBTTagCompound bukkit = nbttagcompound.getCompound("bukkit");
|
|
|
|
s = bukkit.hasKeyOfType("lastKnownName", 8) ? bukkit.getString("lastKnownName") : s;
|
|
|
|
}
|
|
|
|
+ if (nbttagcompound == null) entityplayer.moveToSpawn(worldserver); // Paper - only move to spawn on first login, otherwise, stay where you are....
|
|
|
|
// CraftBukkit end
|
|
|
|
|
2020-04-19 15:11:02 +08:00
|
|
|
entityplayer.spawnIn(worldserver);
|