Don't skip full player connection tick when dead

Still need to send keep alives and kick for idle

Fixes #3299
This commit is contained in:
Aikar 2020-05-06 19:30:47 -04:00
parent e2c23475b5
commit 597263fd55
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
5 changed files with 22 additions and 15 deletions

View file

@ -60,7 +60,7 @@ index f1222fcb2bd52b8781d0f92c94e1472fa7b1e493..28f48f22522ef8c3c66381abcf017f08
if (entityplayer != null) {
this.g = LoginListener.EnumProtocolState.DELAY_ACCEPT;
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 2e81f3a1d93d66c94e9f0d425f9cee6db4940913..8800a8fcf9a09aa8cf5555e136734856d0c5b1f4 100644
index 2e81f3a1d93d66c94e9f0d425f9cee6db4940913..d77b28ab4a5fc93a325a0d5594f66f4f143bd318 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -69,6 +69,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -71,7 +71,7 @@ index 2e81f3a1d93d66c94e9f0d425f9cee6db4940913..8800a8fcf9a09aa8cf5555e136734856
public EntityPlayer player;
private int e;
private long lastKeepAlive = SystemUtils.getMonotonicMillis(); private void setLastPing(long lastPing) { this.lastKeepAlive = lastPing;}; private long getLastPing() { return this.lastKeepAlive;}; // Paper - OBFHELPER
@@ -142,6 +143,17 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -142,6 +143,15 @@ public class PlayerConnection implements PacketListenerPlayIn {
// CraftBukkit end
public void tick() {
@ -82,13 +82,20 @@ index 2e81f3a1d93d66c94e9f0d425f9cee6db4940913..8800a8fcf9a09aa8cf5555e136734856
+ playerJoinReady.run();
+ }
+ // Don't tick if not valid (dead), otherwise we load chunks below
+ if (!this.player.valid) {
+ return;
+ }
+ if (this.player.valid) {
+ // Paper end
this.syncPosition();
this.player.lastX = this.player.locX();
this.player.lastY = this.player.locY();
@@ -183,7 +193,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
this.r = null;
this.D = false;
this.E = 0;
- }
+ }} // Paper - end if (valid)
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 6a4e4f93eb36ca388523a36abf38bcae3ad375e8..61c7f5f9528ceea34af8dbf4503b9c320b7f67a1 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java

View file

@ -9,10 +9,10 @@ their position to the ground/exit location when entering the bed, resulting in
the server believing they're still in the air.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 8800a8fcf9a09aa8cf5555e136734856d0c5b1f4..38ec22f4c0348e9198eededee05cde58c0248de4 100644
index d77b28ab4a5fc93a325a0d5594f66f4f143bd318..0ad23cd1f79621e64fa25582b36b1b26301e2264 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -162,7 +162,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -160,7 +160,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
this.player.setLocation(this.l, this.m, this.n, this.player.yaw, this.player.pitch);
++this.e;
this.processedMovePackets = this.receivedMovePackets;

View file

@ -69,10 +69,10 @@ index 0b23a0548d52a30c064d624e39a896a9791aab3b..c988c929f1063b417d10d84b0c131277
public boolean hasPermission(int i) {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 38ec22f4c0348e9198eededee05cde58c0248de4..a180df220e46eb62f00ae00e2482e1d8d07cb107 100644
index 0ad23cd1f79621e64fa25582b36b1b26301e2264..13b4bab38203eccf09d805c441615f61bc796190 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -576,8 +576,12 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -574,8 +574,12 @@ public class PlayerConnection implements PacketListenerPlayIn {
ParseResults<CommandListenerWrapper> parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener());
this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
@ -87,7 +87,7 @@ index 38ec22f4c0348e9198eededee05cde58c0248de4..a180df220e46eb62f00ae00e2482e1d8
});
}); // Paper - This needs to be on main
}
@@ -587,7 +591,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -585,7 +589,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
builder = builder.createOffset(builder.getInput().lastIndexOf(' ') + 1);
completions.forEach(builder::suggest);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index a180df220e46eb62f00ae00e2482e1d8d07cb107..02bda8bee469da7d1f845fac58f5d5a762fe76c4 100644
index 13b4bab38203eccf09d805c441615f61bc796190..76df4bdf8831f993d52bb6561ff5e05c774811e7 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -691,7 +691,14 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -689,7 +689,14 @@ public class PlayerConnection implements PacketListenerPlayIn {
@Override
public void a(PacketPlayInPickItem packetplayinpickitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinpickitem, this, this.player.getWorldServer());

View file

@ -13,10 +13,10 @@ it is triggering a massive movement velocity.
This will ensure that the servers position is synchronized anytime player is teleported.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 02bda8bee469da7d1f845fac58f5d5a762fe76c4..a188d9f3b600e1013e31d681f9c6a8deb64ada7e 100644
index 76df4bdf8831f993d52bb6561ff5e05c774811e7..10155fcfa5936c6fce2300e21352c5a56b75de6c 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -500,6 +500,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -498,6 +498,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
this.o = this.teleportPos.x;
this.p = this.teleportPos.y;
this.q = this.teleportPos.z;
@ -24,7 +24,7 @@ index 02bda8bee469da7d1f845fac58f5d5a762fe76c4..a188d9f3b600e1013e31d681f9c6a8de
if (this.player.H()) {
this.player.I();
}
@@ -1271,6 +1272,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1269,6 +1270,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
this.A = this.e;
this.player.setLocation(d0, d1, d2, f, f1);