13
0
geforkt von Mirrors/Paper

Fix more null pointer issues around deleted worlds - Fixes #3660

Dieser Commit ist enthalten in:
Aikar 2020-06-28 18:44:34 -04:00
Ursprung 6c6318cb3a
Commit f339d6e162
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 401ADFC9891FAAFE
16 geänderte Dateien mit 65 neuen und 132 gelöschten Zeilen

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Fix reducedDebugInfo not initialized on client
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 5bed3682af9eb63b355bb24bbee466a05ae7cc34..b6d4db1fffb7bab56f9a181e75579775e7d9fafd 100644
index 5bed3682af9eb63b355bb24bbee466a05ae7cc34..675b6b521f0583ccbc9f34cbc38c0c32d7e7f3f7 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -174,6 +174,7 @@ public abstract class PlayerList {
playerconnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
playerconnection.sendPacket(new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b()));
playerconnection.sendPacket(new PacketPlayOutTags(this.server.getTagRegistry()));
+ playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client
+ playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver1.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client
this.d(entityplayer);
entityplayer.getStatisticManager().c();
entityplayer.B().a(entityplayer);

Datei anzeigen

@ -28,7 +28,7 @@ and then catch exceptions and close if they fire.
Part of this commit was authored by: Spottedleaf
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index c84ee96cbed69cca311dd546e562a5322a03fd20..e27c96a1f53f6a2929b8daed9844320da6c57234 100644
index c84ee96cbed69cca311dd546e562a5322a03fd20..bd33f85cfe00cda72efb871f1fc11bebfb0ce700 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -65,6 +65,10 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@ -84,7 +84,7 @@ index c84ee96cbed69cca311dd546e562a5322a03fd20..e27c96a1f53f6a2929b8daed9844320d
+ }
+ // Paper start
+ private static boolean canSendImmediate(NetworkManager networkManager, Packet<?> packet) {
+ return networkManager.isPending || networkManager.protocol != EnumProtocol.PLAY || networkManager.queueImmunity ||
+ return networkManager.isPending || networkManager.protocol != EnumProtocol.PLAY ||
+ packet instanceof PacketPlayOutKeepAlive ||
+ packet instanceof PacketPlayOutChat ||
+ packet instanceof PacketPlayOutTabComplete;
@ -337,26 +337,6 @@ index 2d8e6a2f4a0c3c5d74a647d7164b0028781d3bf5..545dbe6ddcce1d172f465b4a7ab85654
default boolean packetTooLarge(NetworkManager manager) {
return false;
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 139104c436c9a04865ec4138606e82091be8b65f..344d7f62dd77cb2ecaf324a1fe88c6fabbddbc64 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -154,6 +154,7 @@ public abstract class PlayerList {
entityplayer.playerInteractManager.a((WorldServer) entityplayer.world);
entityplayer.setPositionRaw(loc.getX(), loc.getY(), loc.getZ()); // Paper - set raw so we aren't fully joined to the world (not added to chunk or world)
entityplayer.setYawPitch(loc.getYaw(), loc.getPitch());
+ networkmanager.queueImmunity = true; // Paper
// Spigot end
// CraftBukkit - Moved message to after join
@@ -176,6 +177,7 @@ public abstract class PlayerList {
playerconnection.sendPacket(new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b()));
playerconnection.sendPacket(new PacketPlayOutTags(this.server.getTagRegistry()));
playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client
+ networkmanager.queueImmunity = false; // Paper
this.d(entityplayer);
entityplayer.getStatisticManager().c();
entityplayer.B().a(entityplayer);
diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java
index 7abb122943b8a5ce0e888d16d1592a127bb9bb6f..0438126662e7c635d9a4f7b8c54fe7c50403ffe8 100644
--- a/src/main/java/net/minecraft/server/ServerConnection.java

Datei anzeigen

@ -11,10 +11,10 @@ everything to the Whitelist object.
https://github.com/PaperMC/Paper/issues/1880
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 344d7f62dd77cb2ecaf324a1fe88c6fabbddbc64..74642f6536c811c41acbd24d46dd193cdb02e1fb 100644
index e48184b87b2c98cc2f103204ba62ed22a6fd3694..29e026f6f4106da029f9596201167c08078f4a45 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -932,9 +932,9 @@ public abstract class PlayerList {
@@ -930,9 +930,9 @@ public abstract class PlayerList {
}
public boolean isWhitelisted(GameProfile gameprofile, org.bukkit.event.player.PlayerLoginEvent loginEvent) {
boolean isOp = this.operators.d(gameprofile);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 74642f6536c811c41acbd24d46dd193cdb02e1fb..f4b2e3db79beb3f9c355a5e03a439b8e4689f95b 100644
index 29e026f6f4106da029f9596201167c08078f4a45..5ee209074e44a1a1988641098b9376e4f0c04b45 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1050,6 +1050,7 @@ public abstract class PlayerList {
@@ -1048,6 +1048,7 @@ public abstract class PlayerList {
}
public void setHasWhitelist(boolean flag) {

Datei anzeigen

@ -59,10 +59,10 @@ index e87fa15250a57c9b7ed4f4b530289b7b28bb7c9c..83dda2bb95d38ff248d635420c0bf12e
} catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index f4b2e3db79beb3f9c355a5e03a439b8e4689f95b..800f2a0ce13b9394e44277ad2e0455bd88fa34c2 100644
index 5ee209074e44a1a1988641098b9376e4f0c04b45..b00825156f12fabab0fc740f909363846cee168e 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -264,7 +264,7 @@ public abstract class PlayerList {
@@ -262,7 +262,7 @@ public abstract class PlayerList {
// CraftBukkit start
WorldServer finalWorldServer = worldserver1;
Entity entity = EntityTypes.a(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerPostRespawnEvent
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 800f2a0ce13b9394e44277ad2e0455bd88fa34c2..7bc1eff8233b1afe66eeb9371e28a9d4396661f5 100644
index b00825156f12fabab0fc740f909363846cee168e..43cb1e5ecc753f431666f326ada590581e930339 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -666,9 +666,14 @@ public abstract class PlayerList {
@@ -664,9 +664,14 @@ public abstract class PlayerList {
// this.a(entityplayer1, entityplayer, worldserver1); // CraftBukkit - removed
boolean flag2 = false;
@ -24,7 +24,7 @@ index 800f2a0ce13b9394e44277ad2e0455bd88fa34c2..7bc1eff8233b1afe66eeb9371e28a9d4
WorldServer worldserver1 = this.server.getWorldServer(entityplayer.getSpawnDimension());
if (worldserver1 != null) {
Optional optional;
@@ -709,6 +714,7 @@ public abstract class PlayerList {
@@ -707,6 +712,7 @@ public abstract class PlayerList {
location = respawnEvent.getRespawnLocation();
if (!flag) entityplayer.reset(); // SPIGOT-4785
@ -32,7 +32,7 @@ index 800f2a0ce13b9394e44277ad2e0455bd88fa34c2..7bc1eff8233b1afe66eeb9371e28a9d4
} else {
location.setWorld(worldserver.getWorld());
}
@@ -766,6 +772,13 @@ public abstract class PlayerList {
@@ -764,6 +770,13 @@ public abstract class PlayerList {
if (entityplayer.playerConnection.isDisconnected()) {
this.savePlayerFile(entityplayer);
}

Datei anzeigen

@ -7,10 +7,10 @@ The problem was we were checking isExpired() on the entry, but if it
was expired at that point, then it would be null.
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 7bc1eff8233b1afe66eeb9371e28a9d4396661f5..3a21a07906417c14d000b7e22bd190f8c258d0fb 100644
index 43cb1e5ecc753f431666f326ada590581e930339..dadb3e4aa670d3e3a7a6672da55ebc26a86bb666 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -533,8 +533,10 @@ public abstract class PlayerList {
@@ -531,8 +531,10 @@ public abstract class PlayerList {
Player player = entity.getBukkitEntity();
PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.networkManager.getRawAddress()).getAddress());

Datei anzeigen

@ -18,10 +18,10 @@ index e505f7c9b6e36262d01b5f8103db3df03a95a93d..ec160ddedf8b6fcbfd357afcc5f9e58e
PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver.getWorld());
this.world.getServer().getPluginManager().callEvent(changeEvent);
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 3a21a07906417c14d000b7e22bd190f8c258d0fb..56cd5396f27f8f582f17bd74b8a72379557d7e8f 100644
index dadb3e4aa670d3e3a7a6672da55ebc26a86bb666..82259e8404d350cb9578e8a55d9c11b1e5b9a629 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -761,6 +761,8 @@ public abstract class PlayerList {
@@ -759,6 +759,8 @@ public abstract class PlayerList {
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect));
}

Datei anzeigen

@ -40,10 +40,10 @@ index b27260270de80de371a5a71fa0516aa43c44c83e..1cc40b1f0af9e617b2a71bcc442543e1
Stream<VoxelShape> c(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate<Entity> predicate);
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 56cd5396f27f8f582f17bd74b8a72379557d7e8f..cac27c509dd3bec9f7feabf5804d1140055b1c6e 100644
index 82259e8404d350cb9578e8a55d9c11b1e5b9a629..a9dc7807508e5227b59a750f982bf7a0740fa493 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -724,6 +724,7 @@ public abstract class PlayerList {
@@ -722,6 +722,7 @@ public abstract class PlayerList {
entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
// CraftBukkit end

Datei anzeigen

@ -273,10 +273,10 @@ index bb4d54ebee573964cf3026888da108584b12972f..09f94bd242318155dbb46e12224ad3e4
list.stream().map((playerchunk) -> {
CompletableFuture completablefuture;
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 610c3ed31e0dceeded4dbd5f63db23def88e1ea6..62dc7d7cebc4b7e4a64eda6130c988251a55a6fa 100644
index 6f6d1d4c733faa80045fb63269b16ba127c2b616..2602c326cf8d3516162fcc08f0f40ba4ee5f6a16 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -431,7 +431,7 @@ public abstract class PlayerList {
@@ -429,7 +429,7 @@ public abstract class PlayerList {
cserver.getPluginManager().callEvent(playerQuitEvent);
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Broadcast join message to console
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 62dc7d7cebc4b7e4a64eda6130c988251a55a6fa..c79572a38acba2413a1288c40a317dd102da6520 100644
index 2602c326cf8d3516162fcc08f0f40ba4ee5f6a16..00071913c0bb4deec7501a54818a2a1d6febc769 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -213,9 +213,9 @@ public abstract class PlayerList {
@@ -211,9 +211,9 @@ public abstract class PlayerList {
joinMessage = playerJoinEvent.getJoinMessage();
if (joinMessage != null && joinMessage.length() > 0) {

Datei anzeigen

@ -52,23 +52,23 @@ index 4ab719930f5b35c0ae221e9345f1e2eda7d9d719..8de86684dda275585826617b41d6792f
if (!(entity instanceof EntityComplexPart)) {
EntityTypes<?> entitytypes = entity.getEntityType();
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index c79572a38acba2413a1288c40a317dd102da6520..0f50aef7ff3c06cad0afa22924da170e04780053 100644
index 00071913c0bb4deec7501a54818a2a1d6febc769..18272d56bdac0ff76092d8d834c53474516732a8 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -202,6 +202,12 @@ public abstract class PlayerList {
@@ -200,6 +200,12 @@ public abstract class PlayerList {
this.j.put(entityplayer.getUniqueID(), entityplayer);
// this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer})); // CraftBukkit - replaced with loop below
+ // Paper start - correctly register player BEFORE PlayerJoinEvent, so the entity is valid and doesn't require tick delay hacks
+ entityplayer.supressTrackerForLogin = true;
+ worldserver.addPlayerJoin(entityplayer);
+ worldserver1.addPlayerJoin(entityplayer);
+ this.server.getBossBattleCustomData().a(entityplayer); // see commented out section below worldserver.addPlayerJoin(entityplayer);
+ mountSavedVehicle(entityplayer, worldserver, nbttagcompound);
+ mountSavedVehicle(entityplayer, worldserver1, nbttagcompound);
+ // Paper end
// CraftBukkit start
PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(cserver.getPlayer(entityplayer), joinMessage);
cserver.getPluginManager().callEvent(playerJoinEvent);
@@ -236,6 +242,8 @@ public abstract class PlayerList {
@@ -234,6 +240,8 @@ public abstract class PlayerList {
entityplayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer1}));
}
entityplayer.sentListPacket = true;
@ -77,19 +77,19 @@ index c79572a38acba2413a1288c40a317dd102da6520..0f50aef7ff3c06cad0afa22924da170e
// CraftBukkit end
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.datawatcher, true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
@@ -261,6 +269,11 @@ public abstract class PlayerList {
@@ -259,6 +267,11 @@ public abstract class PlayerList {
playerconnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobeffect));
}
+ // Paper start - move vehicle into method so it can be called above - short circuit around that code
+ onPlayerJoinFinish(entityplayer, worldserver, s1);
+ onPlayerJoinFinish(entityplayer, worldserver1, s1);
+ }
+ private void mountSavedVehicle(EntityPlayer entityplayer, WorldServer worldserver, NBTTagCompound nbttagcompound) {
+ private void mountSavedVehicle(EntityPlayer entityplayer, WorldServer worldserver1, NBTTagCompound nbttagcompound) {
+ // Paper end
if (nbttagcompound != null && nbttagcompound.hasKeyOfType("RootVehicle", 10)) {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
// CraftBukkit start
@@ -309,6 +322,10 @@ public abstract class PlayerList {
@@ -307,6 +320,10 @@ public abstract class PlayerList {
}
}

Datei anzeigen

@ -110,18 +110,10 @@ index 1b9a089eddacbaf1a7d7e19478ee756b4ab601b2..4f37401909f1845d0f18aa497a6561b7
this.minecraftServer.getMethodProfiler().enter("keepAlive");
// Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 0f50aef7ff3c06cad0afa22924da170e04780053..f7c23ec053b261a5e7e069fb61dd803c385d6758 100644
index 18272d56bdac0ff76092d8d834c53474516732a8..045d85016edff8e1e8c775f8c701ac806fb3d4e1 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -18,6 +18,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
import javax.annotation.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -54,11 +55,12 @@ public abstract class PlayerList {
@@ -54,11 +54,12 @@ public abstract class PlayerList {
private static final SimpleDateFormat g = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
private final MinecraftServer server;
public final List<EntityPlayer> players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety
@ -135,7 +127,7 @@ index 0f50aef7ff3c06cad0afa22924da170e04780053..f7c23ec053b261a5e7e069fb61dd803c
// CraftBukkit start
// private final Map<UUID, ServerStatisticManager> o;
// private final Map<UUID, AdvancementDataPlayer> p;
@@ -97,6 +99,11 @@ public abstract class PlayerList {
@@ -97,6 +98,11 @@ public abstract class PlayerList {
}
public void a(NetworkManager networkmanager, EntityPlayer entityplayer) {
@ -147,7 +139,7 @@ index 0f50aef7ff3c06cad0afa22924da170e04780053..f7c23ec053b261a5e7e069fb61dd803c
entityplayer.loginTime = System.currentTimeMillis(); // Paper
GameProfile gameprofile = entityplayer.getProfile();
UserCache usercache = this.server.getUserCache();
@@ -110,7 +117,7 @@ public abstract class PlayerList {
@@ -110,7 +116,7 @@ public abstract class PlayerList {
if (nbttagcompound != null && nbttagcompound.hasKey("bukkit")) {
NBTTagCompound bukkit = nbttagcompound.getCompound("bukkit");
s = bukkit.hasKeyOfType("lastKnownName", 8) ? bukkit.getString("lastKnownName") : s;
@ -156,33 +148,31 @@ index 0f50aef7ff3c06cad0afa22924da170e04780053..f7c23ec053b261a5e7e069fb61dd803c
// CraftBukkit end
if (nbttagcompound != null) {
@@ -185,6 +192,53 @@ public abstract class PlayerList {
@@ -183,6 +189,51 @@ public abstract class PlayerList {
entityplayer.B().a(entityplayer);
this.sendScoreboard(worldserver1.getScoreboard(), entityplayer);
this.server.invalidatePingSample();
+ // Paper start - async load spawn in chunk
+ WorldServer finalWorldserver = worldserver;
+ WorldServer finalWorldserver1 = worldserver1;
+ WorldServer finalWorldserver = worldserver1;
+ int chunkX = loc.getBlockX() >> 4;
+ int chunkZ = loc.getBlockZ() >> 4;
+ final ChunkCoordIntPair pos = new ChunkCoordIntPair(chunkX, chunkZ);
+ PlayerChunkMap playerChunkMap = finalWorldserver.getChunkProvider().playerChunkMap;
+ PlayerChunkMap playerChunkMap = worldserver1.getChunkProvider().playerChunkMap;
+ playerChunkMap.chunkDistanceManager.addTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair());
+ worldserver.getChunkProvider().tickDistanceManager();
+ worldserver.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> {
+ worldserver1.getChunkProvider().tickDistanceManager();
+ worldserver1.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> {
+ PlayerChunk updatingChunk = playerChunkMap.getUpdatingChunk(pos.pair());
+ if (updatingChunk != null) {
+ return updatingChunk.getEntityTickingFuture();
+ } else {
+ return CompletableFuture.completedFuture(chunk);
+ return java.util.concurrent.CompletableFuture.completedFuture(chunk);
+ }
+ }).thenAccept(chunk -> {
+ playerconnection.playerJoinReady = () -> {
+ postChunkLoadJoin(
+ entityplayer, finalWorldserver, finalWorldserver1, networkmanager, playerconnection,
+ entityplayer, finalWorldserver, networkmanager, playerconnection,
+ nbttagcompound, networkmanager.getSocketAddress().toString(), lastKnownName
+ );
+ //playerChunkMap.chunkDistanceManager.removeTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair());
+ };
+ });
+ }
@ -200,7 +190,7 @@ index 0f50aef7ff3c06cad0afa22924da170e04780053..f7c23ec053b261a5e7e069fb61dd803c
+ });
+ }
+
+ private void postChunkLoadJoin(EntityPlayer entityplayer, WorldServer worldserver, WorldServer worldserver1, NetworkManager networkmanager, PlayerConnection playerconnection, NBTTagCompound nbttagcompound, String s1, String s) {
+ private void postChunkLoadJoin(EntityPlayer entityplayer, WorldServer worldserver1, NetworkManager networkmanager, PlayerConnection playerconnection, NBTTagCompound nbttagcompound, String s1, String s) {
+ pendingPlayers.remove(entityplayer.getUniqueID(), entityplayer);
+ if (!networkmanager.isConnected()) {
+ return;
@ -210,36 +200,7 @@ index 0f50aef7ff3c06cad0afa22924da170e04780053..f7c23ec053b261a5e7e069fb61dd803c
ChatMessage chatmessage;
if (entityplayer.getProfile().getName().equalsIgnoreCase(s)) {
@@ -206,7 +260,7 @@ public abstract class PlayerList {
entityplayer.supressTrackerForLogin = true;
worldserver.addPlayerJoin(entityplayer);
this.server.getBossBattleCustomData().a(entityplayer); // see commented out section below worldserver.addPlayerJoin(entityplayer);
- mountSavedVehicle(entityplayer, worldserver, nbttagcompound);
+ mountSavedVehicle(entityplayer, worldserver, worldserver1, nbttagcompound);
// Paper end
// CraftBukkit start
PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(cserver.getPlayer(entityplayer), joinMessage);
@@ -243,7 +297,6 @@ public abstract class PlayerList {
}
entityplayer.sentListPacket = true;
entityplayer.supressTrackerForLogin = false; // Paper
- ((WorldServer)entityplayer.world).getChunkProvider().playerChunkMap.addEntity(entityplayer); // Paper - track entity now
// CraftBukkit end
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.datawatcher, true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
@@ -270,9 +323,10 @@ public abstract class PlayerList {
}
// Paper start - move vehicle into method so it can be called above - short circuit around that code
+ ((WorldServer)entityplayer.world).getChunkProvider().playerChunkMap.addEntity(entityplayer); // track entity now
onPlayerJoinFinish(entityplayer, worldserver, s1);
}
- private void mountSavedVehicle(EntityPlayer entityplayer, WorldServer worldserver, NBTTagCompound nbttagcompound) {
+ private void mountSavedVehicle(EntityPlayer entityplayer, WorldServer worldserver, WorldServer worldserver1, NBTTagCompound nbttagcompound) {
// Paper end
if (nbttagcompound != null && nbttagcompound.hasKeyOfType("RootVehicle", 10)) {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
@@ -421,6 +475,7 @@ public abstract class PlayerList {
@@ -419,6 +470,7 @@ public abstract class PlayerList {
protected void savePlayerFile(EntityPlayer entityplayer) {
if (!entityplayer.getBukkitEntity().isPersistent()) return; // CraftBukkit
@ -247,7 +208,7 @@ index 0f50aef7ff3c06cad0afa22924da170e04780053..f7c23ec053b261a5e7e069fb61dd803c
this.playerFileData.save(entityplayer);
ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) entityplayer.getStatisticManager(); // CraftBukkit
@@ -445,7 +500,7 @@ public abstract class PlayerList {
@@ -443,7 +495,7 @@ public abstract class PlayerList {
entityplayer.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game");
@ -256,7 +217,7 @@ index 0f50aef7ff3c06cad0afa22924da170e04780053..f7c23ec053b261a5e7e069fb61dd803c
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
if (server.isMainThread()) entityplayer.playerTick(); // SPIGOT-924 // Paper - don't tick during emergency shutdowns (Watchdog)
@@ -498,6 +553,13 @@ public abstract class PlayerList {
@@ -496,6 +548,13 @@ public abstract class PlayerList {
// this.p.remove(uuid);
// CraftBukkit end
}
@ -270,7 +231,7 @@ index 0f50aef7ff3c06cad0afa22924da170e04780053..f7c23ec053b261a5e7e069fb61dd803c
// CraftBukkit start
// this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer}));
@@ -515,7 +577,7 @@ public abstract class PlayerList {
@@ -513,7 +572,7 @@ public abstract class PlayerList {
cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity());
// CraftBukkit end
@ -279,7 +240,7 @@ index 0f50aef7ff3c06cad0afa22924da170e04780053..f7c23ec053b261a5e7e069fb61dd803c
}
// CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer
@@ -534,6 +596,13 @@ public abstract class PlayerList {
@@ -532,6 +591,13 @@ public abstract class PlayerList {
list.add(entityplayer);
}
}

Datei anzeigen

@ -567,10 +567,10 @@ index 026562c72d7e95345d9369c6d6331cf6cedb8f17..fe343f70ce8024c86363637fda8e5c09
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index ae030fd102549aa6f721c27be090a3a230d789bb..46df57969764244720b4d62883cec64e6d64816d 100644
index 045d85016edff8e1e8c775f8c701ac806fb3d4e1..0ad06509f26a7677e48f4bfb9c979a42fb6a4f74 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -177,7 +177,7 @@ public abstract class PlayerList {
@@ -175,7 +175,7 @@ public abstract class PlayerList {
boolean flag1 = gamerules.getBoolean(GameRules.REDUCED_DEBUG_INFO);
// Spigot - view distance
@ -579,7 +579,7 @@ index ae030fd102549aa6f721c27be090a3a230d789bb..46df57969764244720b4d62883cec64e
entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
@@ -819,7 +819,7 @@ public abstract class PlayerList {
@@ -814,7 +814,7 @@ public abstract class PlayerList {
// CraftBukkit start
WorldData worlddata = worldserver1.getWorldData();
entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver1.getTypeKey(), worldserver1.getDimensionKey(), BiomeManager.a(worldserver1.getSeed()), entityplayer1.playerInteractManager.getGameMode(), entityplayer1.playerInteractManager.c(), worldserver1.isDebugWorld(), worldserver1.isFlatWorld(), flag));
@ -588,7 +588,7 @@ index ae030fd102549aa6f721c27be090a3a230d789bb..46df57969764244720b4d62883cec64e
entityplayer1.spawnIn(worldserver1);
entityplayer1.dead = false;
entityplayer1.playerConnection.teleport(new Location(worldserver1.getWorld(), entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.yaw, entityplayer1.pitch));
@@ -1286,7 +1286,7 @@ public abstract class PlayerList {
@@ -1281,7 +1281,7 @@ public abstract class PlayerList {
public void a(int i) {
this.viewDistance = i;

Datei anzeigen

@ -1144,29 +1144,21 @@ index 681de2638eb606185077668d87340f7258e2ad90..fcd30d3fa5bac44ca71714a13917d847
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index ea2b2fbfe76ec4c86ac3b236c2daad3e75caa9c3..8326ce64ec57d84b768a0cf0d7873f1e1ea68456 100644
index 0ad06509f26a7677e48f4bfb9c979a42fb6a4f74..3c238f7957d28f3edb6481a89ea96d6cbbbc96d8 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -200,8 +200,8 @@ public abstract class PlayerList {
@@ -196,8 +196,8 @@ public abstract class PlayerList {
final ChunkCoordIntPair pos = new ChunkCoordIntPair(chunkX, chunkZ);
PlayerChunkMap playerChunkMap = finalWorldserver.getChunkProvider().playerChunkMap;
PlayerChunkMap playerChunkMap = worldserver1.getChunkProvider().playerChunkMap;
playerChunkMap.chunkDistanceManager.addTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair());
- worldserver.getChunkProvider().tickDistanceManager();
- worldserver.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> {
+ worldserver.getChunkProvider().markAreaHighPriority(pos, 28, 3);
+ worldserver.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, false).thenApply(chunk -> {
- worldserver1.getChunkProvider().tickDistanceManager();
- worldserver1.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> {
+ worldserver1.getChunkProvider().markAreaHighPriority(pos, 28, 3);
+ worldserver1.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, false).thenApply(chunk -> {
PlayerChunk updatingChunk = playerChunkMap.getUpdatingChunk(pos.pair());
if (updatingChunk != null) {
return updatingChunk.getEntityTickingFuture();
@@ -214,7 +214,6 @@ public abstract class PlayerList {
entityplayer, finalWorldserver, finalWorldserver1, networkmanager, playerconnection,
nbttagcompound, networkmanager.getSocketAddress().toString(), lastKnownName
);
- //playerChunkMap.chunkDistanceManager.removeTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair());
};
});
}
@@ -618,6 +617,7 @@ public abstract class PlayerList {
@@ -613,6 +613,7 @@ public abstract class PlayerList {
SocketAddress socketaddress = loginlistener.networkManager.getSocketAddress();
EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(World.OVERWORLD), gameprofile, new PlayerInteractManager(this.server.getWorldServer(World.OVERWORLD)));
@ -1174,7 +1166,7 @@ index ea2b2fbfe76ec4c86ac3b236c2daad3e75caa9c3..8326ce64ec57d84b768a0cf0d7873f1e
Player player = entity.getBukkitEntity();
PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.networkManager.getRawAddress()).getAddress());
@@ -813,6 +813,7 @@ public abstract class PlayerList {
@@ -808,6 +809,7 @@ public abstract class PlayerList {
// CraftBukkit end
worldserver.getChunkProvider().addTicket(TicketType.POST_TELEPORT, new ChunkCoordIntPair(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper

Datei anzeigen

@ -11,10 +11,10 @@ This will drastically cut down on packet sending cost for worlds with
lots of players in them.
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index a8100f7ade20932a87c55750b412d6a755a9cdd5..ea744e2fdf7a256d9f04786a670c44e8b517f281 100644
index 3c238f7957d28f3edb6481a89ea96d6cbbbc96d8..3c5ba8f2fd59d37639f87ac888cc950e7cd628f7 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1063,16 +1063,40 @@ public abstract class PlayerList {
@@ -1059,16 +1059,40 @@ public abstract class PlayerList {
}
public void sendPacketNearby(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, double d3, ResourceKey<World> resourcekey, Packet<?> packet) {