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
|
2021-02-22 03:45:33 +08:00
|
|
|
index cfccab0b33dfa387fdab09ad51d518d42b1b5775..950a16e8aafe71b54b4ba46b61b5d71f8aa3cf94 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
|
2021-02-22 03:45:33 +08:00
|
|
|
@@ -125,7 +125,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);
|
2020-06-26 09:53:21 +08:00
|
|
|
this.G = 1.0F;
|
2020-08-25 10:22:08 +08:00
|
|
|
- this.c(worldserver);
|
|
|
|
+ //this.c(worldserver); // Paper - don't move to spawn on login, only first join
|
2020-11-03 10:22:15 +08:00
|
|
|
this.co = minecraftserver.a(this);
|
2020-04-10 09:22:21 +08:00
|
|
|
|
|
|
|
this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
|
2021-02-22 03:45:33 +08:00
|
|
|
@@ -177,6 +177,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2020-04-10 09:22:21 +08:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
|
2020-08-25 10:22:08 +08:00
|
|
|
+ public final void moveToSpawn(WorldServer worldserver) { c(worldserver); } // Paper - OBFHELPER
|
|
|
|
private void c(WorldServer worldserver) {
|
2020-04-10 09:22:21 +08:00
|
|
|
BlockPosition blockposition = worldserver.getSpawn();
|
|
|
|
|
2021-02-22 03:45:33 +08:00
|
|
|
@@ -354,7 +355,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2020-06-26 09:53:21 +08:00
|
|
|
position = Vec3D.a(((WorldServer) world).getSpawn());
|
2020-04-19 15:11:02 +08:00
|
|
|
}
|
|
|
|
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.playerInteractManager.a((WorldServer) world);
|
2020-06-26 09:53:21 +08:00
|
|
|
}
|
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
|
2021-02-22 03:45:33 +08:00
|
|
|
index c52c6cc6ab0bed4fbd088f6d32455e1a58a70c16..ce097978a072dd5499169277aa1143be97c3b4e1 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
|
2021-02-22 03:45:33 +08:00
|
|
|
@@ -136,6 +136,8 @@ public abstract class PlayerList {
|
2020-06-26 09:53:21 +08:00
|
|
|
worldserver1 = worldserver;
|
2020-04-10 09:22:21 +08:00
|
|
|
}
|
|
|
|
|
2020-06-26 09:53:21 +08:00
|
|
|
+ if (nbttagcompound == null) entityplayer.moveToSpawn(worldserver1); // Paper - only move to spawn on first login, otherwise, stay where you are....
|
|
|
|
+
|
|
|
|
entityplayer.spawnIn(worldserver1);
|
|
|
|
entityplayer.playerInteractManager.a((WorldServer) entityplayer.world);
|
|
|
|
String s1 = "local";
|