mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-26 09:42:06 -07:00
Always call plugin message dispatch on PlayerConnection
This commit is contained in:
@@ -100,7 +100,7 @@ index 962084054c0208470d0c3c99c5dca6327c9b8752..2abc21102bbd2da79dc0c50826cff7da
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
index ab2bcd5b547c8db418de7ea0b7f144058aa8b0f4..1ae3724eec5fac852c6cc6bb88b1ecb9f0b790f0 100644
|
||||
index b2b5fe493f71d7300e5009ae0307dbfd8da99991..27b8ce14ad51566155e457279ec3db1c4b755da7 100644
|
||||
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -38,12 +38,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -185,7 +185,7 @@ index ab2bcd5b547c8db418de7ea0b7f144058aa8b0f4..1ae3724eec5fac852c6cc6bb88b1ecb9
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -225,20 +255,23 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -224,20 +254,23 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
protected void keepConnectionAlive() {
|
||||
Profiler.get().push("keepAlive");
|
||||
long millis = Util.getMillis();
|
||||
@@ -223,7 +223,7 @@ index ab2bcd5b547c8db418de7ea0b7f144058aa8b0f4..1ae3724eec5fac852c6cc6bb88b1ecb9
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,6 +451,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -417,6 +450,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
}
|
||||
|
||||
protected CommonListenerCookie createCookie(ClientInformation clientInformation) {
|
||||
|
@@ -48,7 +48,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,8 +_,81 @@
|
||||
@@ -90,8 +_,80 @@
|
||||
public void handlePong(ServerboundPongPacket packet) {
|
||||
}
|
||||
|
||||
@@ -93,10 +93,9 @@
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ this.cserver.getMessenger().dispatchIncomingMessage(paperConnection(), identifier.toString(), data);
|
||||
+ if (this instanceof ServerGamePacketListenerImpl gamePacketListener) {
|
||||
+ this.cserver.getMessenger().dispatchIncomingMessage(gamePacketListener.player.getBukkitEntity(), identifier.toString(), data);
|
||||
+ } else if (this instanceof ServerConfigurationPacketListenerImpl configurationPacketListener) {
|
||||
+ this.cserver.getMessenger().dispatchIncomingMessage(configurationPacketListener.paperConnection, identifier.toString(), data);
|
||||
+ }
|
||||
+ } catch (final Exception e) {
|
||||
+ ServerGamePacketListenerImpl.LOGGER.error("Couldn't handle custom payload on channel {}", identifier, e);
|
||||
@@ -161,7 +160,7 @@
|
||||
@Override
|
||||
public void handleCookieResponse(ServerboundCookieResponsePacket packet) {
|
||||
- this.disconnect(DISCONNECT_UNEXPECTED_QUERY);
|
||||
+ if (this.getCookieConnection().handleCookieResponse(packet)) return; // Paper
|
||||
+ if (this.paperConnection().handleCookieResponse(packet)) return; // Paper
|
||||
+ this.disconnect(DISCONNECT_UNEXPECTED_QUERY, io.papermc.paper.connection.DisconnectionReason.INVALID_COOKIE); // Paper - kick event cause
|
||||
}
|
||||
|
||||
@@ -317,11 +316,11 @@
|
||||
+
|
||||
+ public abstract void disconnectAsync(DisconnectionDetails disconnectionInfo);
|
||||
+
|
||||
+ public abstract io.papermc.paper.connection.ReadablePlayerCookieConnectionImpl getCookieConnection();
|
||||
+
|
||||
+ public boolean isTransferred() {
|
||||
+ return this.transferred;
|
||||
+ }
|
||||
+
|
||||
+ public abstract io.papermc.paper.connection.PaperCommonConnection<?> paperConnection();
|
||||
+ // Paper end - add proper async disconnect
|
||||
|
||||
protected boolean isSingleplayerOwner() {
|
||||
|
@@ -99,7 +99,7 @@
|
||||
this.connection.send(new ClientboundDisconnectPacket(DISCONNECT_REASON_INVALID_DATA));
|
||||
this.connection.disconnect(DISCONNECT_REASON_INVALID_DATA);
|
||||
}
|
||||
@@ -180,4 +_,29 @@
|
||||
@@ -180,4 +_,35 @@
|
||||
this.startNextTask();
|
||||
}
|
||||
}
|
||||
@@ -127,5 +127,11 @@
|
||||
+ public void handleCustomPayload(net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket packet) {
|
||||
+ super.handleCustomPayload(packet);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public io.papermc.paper.connection.PaperPlayerConfigurationConnection paperConnection() {
|
||||
+ return paperConnection;
|
||||
+ }
|
||||
+
|
||||
+ // Paper end
|
||||
}
|
||||
|
@@ -2610,7 +2610,7 @@
|
||||
if (!this.receivedMovementThisTick) {
|
||||
this.player.setKnownMovement(Vec3.ZERO);
|
||||
}
|
||||
@@ -2078,4 +_,93 @@
|
||||
@@ -2078,4 +_,97 @@
|
||||
interface EntityInteraction {
|
||||
InteractionResult run(ServerPlayer player, Entity entity, InteractionHand hand);
|
||||
}
|
||||
@@ -2702,5 +2702,9 @@
|
||||
+ return this.playerGameConnection;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public io.papermc.paper.connection.PaperPlayerGameConnection paperConnection() {
|
||||
+ return this.playerGameConnection;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
Reference in New Issue
Block a user