2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2020-04-10 03:22:21 +02: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-07-23 01:35:44 +02:00
|
|
|
index a03340ae87bf967895d39bed1767f9753c7f0c60..48ee5d7beaf336f7eb440a4a8a6e3bba2321b0b9 100644
|
2020-04-10 03:22:21 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
2020-06-27 06:57:36 +02:00
|
|
|
@@ -118,7 +118,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2020-04-10 03:22:21 +02:00
|
|
|
this.serverStatisticManager = minecraftserver.getPlayerList().getStatisticManager(this);
|
|
|
|
this.advancementDataPlayer = minecraftserver.getPlayerList().f(this);
|
2020-06-26 03:53:21 +02:00
|
|
|
this.G = 1.0F;
|
|
|
|
- this.b(worldserver);
|
|
|
|
+ //this.b(worldserver); // Paper - don't move to spawn on login, only first join
|
2020-04-10 03:22:21 +02:00
|
|
|
|
|
|
|
this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
|
|
|
|
|
2020-06-30 07:20:29 +02:00
|
|
|
@@ -168,6 +168,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2020-04-10 03:22:21 +02:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
|
2020-06-26 03:53:21 +02:00
|
|
|
+ public final void moveToSpawn(WorldServer worldserver) { b(worldserver); } // Paper - OBFHELPER
|
|
|
|
private void b(WorldServer worldserver) {
|
2020-04-10 03:22:21 +02:00
|
|
|
BlockPosition blockposition = worldserver.getSpawn();
|
|
|
|
|
2020-06-30 07:20:29 +02:00
|
|
|
@@ -343,7 +344,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2020-06-26 03:53:21 +02:00
|
|
|
position = Vec3D.a(((WorldServer) world).getSpawn());
|
2020-04-19 09:11:02 +02: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 03:53:21 +02:00
|
|
|
}
|
2020-04-10 03:22:21 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
2020-07-23 01:35:44 +02:00
|
|
|
index f0caadb6117d761e6ce0ee573e2c351b894a00c2..4676b4dc4b22c838c946a342af9e88b56436de70 100644
|
2020-04-10 03:22:21 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
2020-06-26 03:53:21 +02:00
|
|
|
@@ -134,6 +134,8 @@ public abstract class PlayerList {
|
|
|
|
worldserver1 = worldserver;
|
2020-04-10 03:22:21 +02:00
|
|
|
}
|
|
|
|
|
2020-06-26 03:53:21 +02: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";
|