Archiviert
13
0

Fire PlayerConnectionCloseEvent for configuration packet listener

If the player moves to the configuration stage, we also need
to fire the event.
Dieser Commit ist enthalten in:
Spottedleaf 2023-09-26 09:20:17 -07:00
Ursprung c207429b21
Commit b3b961f9d5
9 geänderte Dateien mit 18 neuen und 19 gelöschten Zeilen

Datei anzeigen

@ -39,23 +39,22 @@ public net.minecraft.server.network.ServerLoginPacketListenerImpl state
public net.minecraft.server.network.ServerLoginPacketListenerImpl gameProfile
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 6fcbf8205e1852d5193a42bfe1154f62ab01e7ad..9f8fbb8231b60c287c9442365c2f95cde92969b8 100644
index 6fcbf8205e1852d5193a42bfe1154f62ab01e7ad..25881c890c643ce90bdcda6b094d912bafb0ed75 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -644,6 +644,27 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -644,6 +644,26 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
packetlistener1.onDisconnect(ichatbasecomponent);
}
this.pendingActions.clear(); // Free up packet queue.
+ // Paper start - Add PlayerConnectionCloseEvent
+ final PacketListener packetListener = this.getPacketListener();
+ if (packetListener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl) {
+ /* Player was logged in */
+ final net.minecraft.server.network.ServerGamePacketListenerImpl playerConnection = (net.minecraft.server.network.ServerGamePacketListenerImpl) packetListener;
+ new com.destroystokyo.paper.event.player.PlayerConnectionCloseEvent(playerConnection.player.getUUID(),
+ playerConnection.player.getScoreboardName(), ((java.net.InetSocketAddress)address).getAddress(), false).callEvent();
+ } else if (packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl) {
+ if (packetListener instanceof net.minecraft.server.network.ServerCommonPacketListenerImpl commonPacketListener) {
+ /* Player was logged in, either game listener or configuration listener */
+ final com.mojang.authlib.GameProfile profile = commonPacketListener.getOwner();
+ new com.destroystokyo.paper.event.player.PlayerConnectionCloseEvent(profile.getId(),
+ profile.getName(), ((java.net.InetSocketAddress)address).getAddress(), false).callEvent();
+ } else if (packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl loginListener) {
+ /* Player is login stage */
+ final net.minecraft.server.network.ServerLoginPacketListenerImpl loginListener = (net.minecraft.server.network.ServerLoginPacketListenerImpl) packetListener;
+ switch (loginListener.state) {
+ case VERIFYING:
+ case WAITING_FOR_DUPE_DISCONNECT:

Datei anzeigen

@ -28,7 +28,7 @@ and then catch exceptions and close if they fire.
Part of this commit was authored by: Spottedleaf, sandtechnology
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 9f8fbb8231b60c287c9442365c2f95cde92969b8..d8ae86dcc07872c63064782c9864b873f07139d1 100644
index 25881c890c643ce90bdcda6b094d912bafb0ed75..1931db6936773657bd43b9b16de950cb3e7a2303 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -84,7 +84,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -237,8 +237,8 @@ index 9f8fbb8231b60c287c9442365c2f95cde92969b8..d8ae86dcc07872c63064782c9864b873
+ this.clearPacketQueue(); // Paper - Optimize network
// Paper start - Add PlayerConnectionCloseEvent
final PacketListener packetListener = this.getPacketListener();
if (packetListener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl) {
@@ -681,4 +765,89 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
if (packetListener instanceof net.minecraft.server.network.ServerCommonPacketListenerImpl commonPacketListener) {
@@ -680,4 +764,89 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
public void setBandwidthLogger(SampleLogger log) {
this.bandwidthDebugMonitor = new BandwidthDebugMonitor(log);
}

Datei anzeigen

@ -494,7 +494,7 @@ index 52eb3176437113f9a0ff85d10ce5c2415e1b5570..b54ddd0ba0b001fbcb1838a838ca4890
}
}
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index d8ae86dcc07872c63064782c9864b873f07139d1..af4ded7a31da34ccebb3cfe9c1eb5d5c918950b1 100644
index 1931db6936773657bd43b9b16de950cb3e7a2303..36a78cc103ddf1cc7ccddefc0b3fd6cef987f67d 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -75,13 +75,13 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {

Datei anzeigen

@ -8,7 +8,7 @@ the world per tick, this attempts to reduce the impact that join floods
has on the server
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index af4ded7a31da34ccebb3cfe9c1eb5d5c918950b1..b9d1eefb2afbf24bdc902c6dea06e911e835d698 100644
index 36a78cc103ddf1cc7ccddefc0b3fd6cef987f67d..f9d7fec242a059a3b056c569ffaf214a361716d6 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -498,14 +498,29 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add API for quit reason
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index b9d1eefb2afbf24bdc902c6dea06e911e835d698..4f5216cb3ac323de1a79c2b9c4d2ddd7c4875138 100644
index f9d7fec242a059a3b056c569ffaf214a361716d6..33a3c657bd390b9e8bc23af93c1107f5327181b2 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -183,12 +183,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {

Datei anzeigen

@ -122,7 +122,7 @@ index 0000000000000000000000000000000000000000..0d7e7db9e37ef0183c32b217bd944fb4
+ COMPRESSION_DISABLED
+}
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 4f5216cb3ac323de1a79c2b9c4d2ddd7c4875138..c06473f8c6cb116071e256747bc95c38dd2015a6 100644
index 33a3c657bd390b9e8bc23af93c1107f5327181b2..332a37dbd3ffa05614ae97b90453fcc242b6007d 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -717,6 +717,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {

Datei anzeigen

@ -264,7 +264,7 @@ index 859af8c845bae9781a62fa4acae56c6e2d449e10..ec7239fd6a2ecf732d2843f9426e4cb6
return this.threshold;
}
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index c06473f8c6cb116071e256747bc95c38dd2015a6..cb82729631f3944cbf068ff730df0c2e1c3b2e1f 100644
index 332a37dbd3ffa05614ae97b90453fcc242b6007d..fc32505422bebd52f5bcd6a6bb7525fa443ee8e0 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -669,11 +669,28 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {

Datei anzeigen

@ -7,7 +7,7 @@ Subject: [PATCH] Detail more information in watchdog dumps
- Dump player name, player uuid, position, and world for packet handling
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index cb82729631f3944cbf068ff730df0c2e1c3b2e1f..fdfd07b76b904e5ad70ca63a44f2442500f1e887 100644
index fc32505422bebd52f5bcd6a6bb7525fa443ee8e0..78e540af673c47f77b5efec4719d5e140da744c2 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -521,7 +521,13 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {

Datei anzeigen

@ -24,7 +24,7 @@ and an action can be defined: DROP or KICK
If interval or rate are less-than 0, the limit is ignored
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index fdfd07b76b904e5ad70ca63a44f2442500f1e887..91fcb63835b0b725c53bc75be782b5c5bcc870e7 100644
index 78e540af673c47f77b5efec4719d5e140da744c2..c0ea20dcee8bb293df96bc6ee019e50ad6b383fd 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -132,6 +132,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {