Properly disallow async Player#chat (#8123)

Clarify asynchronous status of AsyncChatEvent
This commit is contained in:
Jake Potrebic 2023-12-28 16:50:06 -08:00 committed by GitHub
parent 2951732742
commit e4ab50de34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 78 additions and 65 deletions

View file

@ -497,7 +497,7 @@ new file mode 100644
index 0000000000000000000000000000000000000000..4eada40b8abb1833ce623ccee0789555e370d024 index 0000000000000000000000000000000000000000..4eada40b8abb1833ce623ccee0789555e370d024
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/AsyncChatEvent.java +++ b/src/main/java/io/papermc/paper/event/player/AsyncChatEvent.java
@@ -0,0 +1,37 @@ @@ -0,0 +1,47 @@
+package io.papermc.paper.event.player; +package io.papermc.paper.event.player;
+ +
+import java.util.Set; +import java.util.Set;
@ -512,6 +512,16 @@ index 0000000000000000000000000000000000000000..4eada40b8abb1833ce623ccee0789555
+ +
+/** +/**
+ * An event fired when a {@link Player} sends a chat message to the server. + * An event fired when a {@link Player} sends a chat message to the server.
+ * <p>
+ * This event will sometimes fire synchronously, depending on how it was
+ * triggered.
+ * <p>
+ * If a player is the direct cause of this event by an incoming packet, this
+ * event will be asynchronous. If a plugin triggers this event by compelling a
+ * player to chat, this event will be synchronous.
+ * <p>
+ * Care should be taken to check {@link #isAsynchronous()} and treat the event
+ * appropriately.
+ */ + */
+public final class AsyncChatEvent extends AbstractChatEvent { +public final class AsyncChatEvent extends AbstractChatEvent {
+ private static final HandlerList HANDLERS = new HandlerList(); + private static final HandlerList HANDLERS = new HandlerList();

View file

@ -2891,7 +2891,7 @@ index a60fef571c94858998a91711b17d3670c28a81bd..04a728a16bb629adbae1cd8586764a6d
@Override @Override
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 04344fd06419ed849f4e49b89a34d48141410b4e..07161d7d2a16d75497ef4d15af12e0ac09163ad2 100644 index 04344fd06419ed849f4e49b89a34d48141410b4e..36e659171d299b116b48cae868a20be467ce4ae2 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -44,6 +44,7 @@ import net.minecraft.nbt.ListTag; @@ -44,6 +44,7 @@ import net.minecraft.nbt.ListTag;
@ -2940,13 +2940,16 @@ index 04344fd06419ed849f4e49b89a34d48141410b4e..07161d7d2a16d75497ef4d15af12e0ac
this.broadcastChatMessage(playerchatmessage1); this.broadcastChatMessage(playerchatmessage1);
}); });
@@ -1931,7 +1936,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1931,7 +1936,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.handleCommand(s); this.handleCommand(s);
} else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { } else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) {
// Do nothing, this is coming from a plugin // Do nothing, this is coming from a plugin
- } else { - } else {
+ // Paper start + // Paper start
+ } else if (true) { + } else if (true) {
+ if (!async && !org.bukkit.Bukkit.isPrimaryThread()) {
+ org.spigotmc.AsyncCatcher.catchOp("Asynchronous player chat is not allowed here");
+ }
+ final ChatProcessor cp = new ChatProcessor(this.server, this.player, original, async); + final ChatProcessor cp = new ChatProcessor(this.server, this.player, original, async);
+ cp.process(); + cp.process();
+ // Paper end + // Paper end
@ -2954,7 +2957,7 @@ index 04344fd06419ed849f4e49b89a34d48141410b4e..07161d7d2a16d75497ef4d15af12e0ac
Player player = this.getCraftPlayer(); Player player = this.getCraftPlayer();
AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(this.server)); AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(this.server));
String originalFormat = event.getFormat(), originalMessage = event.getMessage(); String originalFormat = event.getFormat(), originalMessage = event.getMessage();
@@ -2918,6 +2928,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2918,6 +2931,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handleClientInformation(ServerboundClientInformationPacket packet) { public void handleClientInformation(ServerboundClientInformationPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
this.player.updateOptions(packet.information()); this.player.updateOptions(packet.information());

View file

@ -1242,7 +1242,7 @@ index 3bd2bddb782d29e647a1f1b362a39d224151f8b1..3851c1026b91b77a02dbb5df1a1eedb2
this.entityManager.saveAll(); this.entityManager.saveAll();
} else { } else {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 07161d7d2a16d75497ef4d15af12e0ac09163ad2..7c1154cd5fcc1f4c86067bb633218de682ef7bef 100644 index 36e659171d299b116b48cae868a20be467ce4ae2..38260251813a8fc5d1f5c1b2bbec9a112d00bafd 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -322,7 +322,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -322,7 +322,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -1261,7 +1261,7 @@ index 07161d7d2a16d75497ef4d15af12e0ac09163ad2..7c1154cd5fcc1f4c86067bb633218de6
} }
@@ -2017,7 +2015,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2020,7 +2018,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} }
private void handleCommand(String s) { private void handleCommand(String s) {
@ -1270,7 +1270,7 @@ index 07161d7d2a16d75497ef4d15af12e0ac09163ad2..7c1154cd5fcc1f4c86067bb633218de6
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s); this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
@@ -2027,7 +2025,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2030,7 +2028,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.cserver.getPluginManager().callEvent(event); this.cserver.getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
@ -1279,7 +1279,7 @@ index 07161d7d2a16d75497ef4d15af12e0ac09163ad2..7c1154cd5fcc1f4c86067bb633218de6
return; return;
} }
@@ -2040,7 +2038,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2043,7 +2041,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
return; return;
} finally { } finally {

View file

@ -17,7 +17,7 @@ Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: SoSeDiK <mrsosedik@gmail.com> Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 5248aaee63e87a339c6debdfbe09707c6849d84b..17b4f7b76eda9735a4be1a60645d44e8f633dd52 100644 index d22341dd864ac3423ec4ae1e3f4febefe24ae3f6..8c8c3085711989c90ea9ae51b3d95abee284a71e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1937,7 +1937,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1937,7 +1937,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -29,7 +29,7 @@ index 5248aaee63e87a339c6debdfbe09707c6849d84b..17b4f7b76eda9735a4be1a60645d44e8
this.handleCommand(s); this.handleCommand(s);
} else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { } else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) {
// Do nothing, this is coming from a plugin // Do nothing, this is coming from a plugin
@@ -2021,7 +2021,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2024,7 +2024,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} }
} }

View file

@ -28,10 +28,10 @@ index 644a0fdea6576647539b96528717dbaeab498d93..221e64a66ff12a8de5c75992fc26a54a
+ // Paper end - PlayerUseUnknownEntityEvent + // Paper end - PlayerUseUnknownEntityEvent
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 17b4f7b76eda9735a4be1a60645d44e8f633dd52..fe6a995331ba489911886047130861496d75979a 100644 index 8c8c3085711989c90ea9ae51b3d95abee284a71e..3c04fa0a96eb4f3ceb50d69f57df339f6eea3ca3 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2404,8 +2404,38 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2407,8 +2407,38 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}); });
} }
} }

View file

@ -14,10 +14,10 @@ To be converted into a Paper-API event at some point in the future?
public net.minecraft.world.entity.player.Player removeEntitiesOnShoulder()V public net.minecraft.world.entity.player.Player removeEntitiesOnShoulder()V
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 3e745e7adb36b9d5cb06754792c891266ec30722..2f6591e5a0e450bfa68ab3e30f88afba68fbef29 100644 index 121cbb94863b7bd6d47ff73ffafb2ef600ad6a96..c90bcd4df41c847c6a33a33efb4c6383894b8a67 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2181,6 +2181,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2184,6 +2184,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
switch (packet.getAction()) { switch (packet.getAction()) {
case PRESS_SHIFT_KEY: case PRESS_SHIFT_KEY:
this.player.setShiftKeyDown(true); this.player.setShiftKeyDown(true);

View file

@ -75,7 +75,7 @@ index 8f826978564a1d144901f1ca2e46c5b083b68945..0100aafc999cadcfa7a904a812355502
this.doCloseContainer(); this.doCloseContainer();
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 1e7d74df49712a3c3e107026406718c16bc3d166..b7ed2403dc0fd86f163b86af6e52aa9f10b607a0 100644 index 8fb792d88852e78fded9f7ae2da26a1d9d09c959..6f6fee0ad12c8a251f86be0fbef32c005e354ee3 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -219,6 +219,7 @@ import org.bukkit.event.inventory.ClickType; @@ -219,6 +219,7 @@ import org.bukkit.event.inventory.ClickType;
@ -86,7 +86,7 @@ index 1e7d74df49712a3c3e107026406718c16bc3d166..b7ed2403dc0fd86f163b86af6e52aa9f
import org.bukkit.event.inventory.InventoryCreativeEvent; import org.bukkit.event.inventory.InventoryCreativeEvent;
import org.bukkit.event.inventory.InventoryType.SlotType; import org.bukkit.event.inventory.InventoryType.SlotType;
import org.bukkit.event.inventory.SmithItemEvent; import org.bukkit.event.inventory.SmithItemEvent;
@@ -2535,10 +2536,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2538,10 +2539,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleContainerClose(ServerboundContainerClosePacket packet) { public void handleContainerClose(ServerboundContainerClosePacket packet) {

View file

@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is
cancelled to avoid this problem. cancelled to avoid this problem.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b7ed2403dc0fd86f163b86af6e52aa9f10b607a0..1e6c704279fe91530a23d17a151d28aa3fb9126e 100644 index 6f6fee0ad12c8a251f86be0fbef32c005e354ee3..70c5255038f5db2a11d8248df59c310e8a1725d0 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2416,6 +2416,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2419,6 +2419,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} }
if (event.isCancelled()) { if (event.isCancelled()) {

View file

@ -22,7 +22,7 @@ it only impacts data sent from the client.
Set -DPaper.maxSignLength=XX to change limit or -1 to disable Set -DPaper.maxSignLength=XX to change limit or -1 to disable
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b0eb46e60fa51386999cda8ecc31ccf2d3e05b99..d8285ff999cfea9a7b62e9914a7a7dfdae2ede76 100644 index 4c4e1631832adb8d6cd8b90e68a4720b10591db8..199d75d5f4832c0cdc5a4e335f92c21f1ee55e18 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -291,6 +291,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -291,6 +291,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -33,7 +33,7 @@ index b0eb46e60fa51386999cda8ecc31ccf2d3e05b99..d8285ff999cfea9a7b62e9914a7a7dfd
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player, CommonListenerCookie clientData) { public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
super(server, connection, clientData, player); // CraftBukkit super(server, connection, clientData, player); // CraftBukkit
@@ -3063,7 +3064,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3066,7 +3067,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleSignUpdate(ServerboundSignUpdatePacket packet) { public void handleSignUpdate(ServerboundSignUpdatePacket packet) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 33a9d4047d3a2bd57b12f3517592a333a574fa32..0bc8e06a2a7bc7858433e78fb0ad381d2fcb1f72 100644 index cb4595bd4d82ae01131cd6cf33ae482e8bfbc1d0..bfc36daa96d1de29c57700740b35dc53e7aae2ca 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2970,16 +2970,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2973,16 +2973,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (!this.player.containerMenu.stillValid(this.player)) { if (!this.player.containerMenu.stillValid(this.player)) {
ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu); ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
} else { } else {

View file

@ -89,10 +89,10 @@ index 3dfbd1225b0c1ee6b6fb2e842efdb1a8ff2c26c6..030d6c0d067dacf4f9603bdfb21acca8
playerlist.sendPlayerPermissionLevel(this); playerlist.sendPlayerPermissionLevel(this);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 85c8dd4f40eb5c71e8df52817167932e70e94c14..9c0cc06f4ebbfbd7959f05cae12a9f9e7e622c04 100644 index 4876b0378641657ee4c3c08586337a952af01839..2a982ec37bfcd70698b6f7bff35e18d5ef932ac8 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3173,7 +3173,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3176,7 +3176,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) { public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) { if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Limit recipe packets
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 5ee4d04f9770672f451b8a87b65075432203e310..498d38a016828384fe86129a7f0412c6aa981a9a 100644 index d3b90fbdd198cdb82263a39561ee5392e32edf41..3b29de365044cf6d51903dd18b6c3ece04a5fff8 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -258,6 +258,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -258,6 +258,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -24,7 +24,7 @@ index 5ee4d04f9770672f451b8a87b65075432203e310..498d38a016828384fe86129a7f0412c6
/* Use thread-safe field access instead /* Use thread-safe field access instead
if (this.chatSpamTickCount > 0) { if (this.chatSpamTickCount > 0) {
--this.chatSpamTickCount; --this.chatSpamTickCount;
@@ -2987,6 +2989,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2990,6 +2992,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {

View file

@ -11,7 +11,7 @@ Subject: [PATCH] Fix interact event not being called sometimes
Co-authored-by: Moulberry <james.jenour@protonmail.com> Co-authored-by: Moulberry <james.jenour@protonmail.com>
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 498d38a016828384fe86129a7f0412c6aa981a9a..f066a3e2c21678f1019d223f97d181aa869ed9cc 100644 index 3b29de365044cf6d51903dd18b6c3ece04a5fff8..2c87b676290e4de8e119f3ba5fd4292af9d0654e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1765,7 +1765,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1765,7 +1765,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -23,7 +23,7 @@ index 498d38a016828384fe86129a7f0412c6aa981a9a..f066a3e2c21678f1019d223f97d181aa
this.player.swing(enumhand, true); this.player.swing(enumhand, true);
} }
} }
@@ -2308,13 +2308,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2311,13 +2311,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
double d3 = this.player.gameMode.getGameModeForPlayer() == GameType.CREATIVE ? 5.0D : 4.5D; double d3 = this.player.gameMode.getGameModeForPlayer() == GameType.CREATIVE ? 5.0D : 4.5D;
// SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time // SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time
// SPIGOT-7429: Make sure to call PlayerInteractEvent for spectators and non-pickable entities // SPIGOT-7429: Make sure to call PlayerInteractEvent for spectators and non-pickable entities

View file

@ -5,10 +5,10 @@ Subject: [PATCH] add RespawnFlags to PlayerRespawnEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 87e118594209d3f483588f5f59013da635f59a24..a4baca36aece8d6944453e87589d363213adee56 100644 index c9a2119728e2a1340fda2071ac54afad93431aaf..60945de12bf3b7068da9897d3af778f4f8577134 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2641,7 +2641,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2644,7 +2644,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
case PERFORM_RESPAWN: case PERFORM_RESPAWN:
if (this.player.wonGame) { if (this.player.wonGame) {
this.player.wonGame = false; this.player.wonGame = false;

View file

@ -131,10 +131,10 @@ index c61754976fab6654f55b1403d769eb1721871dca..236dabc1d4ae9dc9a2a2c07a4a27fc0b
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index a4baca36aece8d6944453e87589d363213adee56..3a7592f022a5fdd90a525d84502b450c08409cf1 100644 index 60945de12bf3b7068da9897d3af778f4f8577134..7223e30011defb34db176408e528025eef96be07 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2650,7 +2650,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2653,7 +2653,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH); this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH);
if (this.server.isHardcore()) { if (this.server.isHardcore()) {

View file

@ -93,10 +93,10 @@ index 6641fd04821240b1bbeff1bd8d996a8f2fff8385..5f625acf04ddb56e3596d086252f9bfc
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 808b000b43c6099bb4d1a0ea3041ec221ce3e6bb..063a4f1d85154e21efc1708feed9e9e33bbe32fb 100644 index 089f4670aec8612b1e0e9cc69d785dcd135dc44a..294074cb4cac5089b57f3629f46d71175911a906 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2473,6 +2473,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2476,6 +2476,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Spigot Start // Spigot Start
public SocketAddress getRawAddress() public SocketAddress getRawAddress()
{ {

View file

@ -209,7 +209,7 @@ index 0616a8e89931680602da2dbc640906708aebd5ca..70458ff8c9bf6f3263868b0f5570840f
if (this.cserver.getServer().isRunning()) { if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event); this.cserver.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 063a4f1d85154e21efc1708feed9e9e33bbe32fb..5382fc27e4f0147cae32c2ee2959428d28ab9265 100644 index 294074cb4cac5089b57f3629f46d71175911a906..dc9b2fb7555d37532569f60fae49091ce2e6c98c 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -342,7 +342,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -342,7 +342,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -364,7 +364,7 @@ index 063a4f1d85154e21efc1708feed9e9e33bbe32fb..5382fc27e4f0147cae32c2ee2959428d
} }
return optional; return optional;
@@ -2280,7 +2280,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2283,7 +2283,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// this.chatSpamTickCount += 20; // this.chatSpamTickCount += 20;
if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
// CraftBukkit end // CraftBukkit end
@ -373,7 +373,7 @@ index 063a4f1d85154e21efc1708feed9e9e33bbe32fb..5382fc27e4f0147cae32c2ee2959428d
} }
} }
@@ -2292,7 +2292,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2295,7 +2295,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
synchronized (this.lastSeenMessages) { synchronized (this.lastSeenMessages) {
if (!this.lastSeenMessages.applyOffset(packet.offset())) { if (!this.lastSeenMessages.applyOffset(packet.offset())) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
@ -382,7 +382,7 @@ index 063a4f1d85154e21efc1708feed9e9e33bbe32fb..5382fc27e4f0147cae32c2ee2959428d
} }
} }
@@ -2445,7 +2445,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2448,7 +2448,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} }
if (i > 4096) { if (i > 4096) {
@ -391,7 +391,7 @@ index 063a4f1d85154e21efc1708feed9e9e33bbe32fb..5382fc27e4f0147cae32c2ee2959428d
} }
} }
@@ -2502,7 +2502,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2505,7 +2505,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Spigot Start // Spigot Start
if ( entity == this.player && !this.player.isSpectator() ) if ( entity == this.player && !this.player.isSpectator() )
{ {
@ -400,7 +400,7 @@ index 063a4f1d85154e21efc1708feed9e9e33bbe32fb..5382fc27e4f0147cae32c2ee2959428d
return; return;
} }
// Spigot End // Spigot End
@@ -2601,7 +2601,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2604,7 +2604,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// CraftBukkit end // CraftBukkit end
} }
} else { } else {
@ -409,7 +409,7 @@ index 063a4f1d85154e21efc1708feed9e9e33bbe32fb..5382fc27e4f0147cae32c2ee2959428d
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
} }
} }
@@ -3010,7 +3010,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3013,7 +3013,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Paper start // Paper start
if (!org.bukkit.Bukkit.isPrimaryThread()) { if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
@ -418,7 +418,7 @@ index 063a4f1d85154e21efc1708feed9e9e33bbe32fb..5382fc27e4f0147cae32c2ee2959428d
return; return;
} }
} }
@@ -3245,7 +3245,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3248,7 +3248,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) { if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) {
if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) { if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) {
@ -427,7 +427,7 @@ index 063a4f1d85154e21efc1708feed9e9e33bbe32fb..5382fc27e4f0147cae32c2ee2959428d
} else { } else {
try { try {
SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator(); SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator();
@@ -3258,7 +3258,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3261,7 +3261,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator)); this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
} catch (ProfilePublicKey.ValidationException profilepublickey_b) { } catch (ProfilePublicKey.ValidationException profilepublickey_b) {
ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage());

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Adds PlayerArmSwingEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4440c872aaf0a708de5c561f46ababadef95d900..2d7b88d0ea0acdd6e40d7c3e622af26de26bc0b7 100644 index 3ed491afc47273cb8d648ff527c81d968a1a3833..8e229a43a5b6042597532419cf6e63439a94d4f9 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2330,7 +2330,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2333,7 +2333,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} // Paper end } // Paper end
// Arm swing animation // Arm swing animation

View file

@ -18,10 +18,10 @@ index 8d2870c780c4c253f6570c7ef73f6e7c2ccc46ad..0cbb5dd17c5b37ad90ce11a31b644707
} }
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7d059605d2682672fd0cb89ae46c539c3f8f6021..64269f1e6c8b5b9911cd36c5d0a11859cd8be599 100644 index 3fb7e355a86851731f5f11b6b8bb8e4515806a33..3d2ef1728a54d7612a773dfb7066b7370c9df178 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2563,8 +2563,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2566,8 +2566,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Refresh the current entity metadata // Refresh the current entity metadata
entity.getEntityData().refresh(ServerGamePacketListenerImpl.this.player); entity.getEntityData().refresh(ServerGamePacketListenerImpl.this.player);
// SPIGOT-7136 - Allays // SPIGOT-7136 - Allays

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent tile entity copies loading chunks
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 74cc0b0044b8ad5fe9afc24b44e5e215ca8f8b4b..406432a6336543b9b537964bdfafd17bf9471859 100644 index f48d6c0b1a9fd86061314d696ff84019667a38a2..238df5ab2bf2a656396bc870678fdfcd77b59375 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3194,7 +3194,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3197,7 +3197,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound); BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound);
if (this.player.level().isLoaded(blockposition)) { if (this.player.level().isLoaded(blockposition)) {

View file

@ -18,10 +18,10 @@ index a305557e97d8719f5f82e70794d15242364ce136..5264235c1547c78b8123e2efb07dcb77
if (dedicatedserverproperties.enableQuery) { if (dedicatedserverproperties.enableQuery) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 406432a6336543b9b537964bdfafd17bf9471859..faf16948a6336ba62a080ce0a28167cd57625502 100644 index 238df5ab2bf2a656396bc870678fdfcd77b59375..175c62758f11cba53df53286c0c84472234b6bfa 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2758,7 +2758,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2761,7 +2761,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH); this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH);
if (this.server.isHardcore()) { if (this.server.isHardcore()) {
this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Do not accept invalid client settings
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index faf16948a6336ba62a080ce0a28167cd57625502..d0895945970cf562dabe6adcc8f843fcef49ffda 100644 index 175c62758f11cba53df53286c0c84472234b6bfa..bfc1404bd1478f2a7c475d55b53a70181506c4f8 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3318,6 +3318,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3321,6 +3321,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleClientInformation(ServerboundClientInformationPacket packet) { public void handleClientInformation(ServerboundClientInformationPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Fix Spigot Config not using commands.spam-exclusions
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index d0895945970cf562dabe6adcc8f843fcef49ffda..009a14ad5de4bf98ec50cc4ba348445266c1c967 100644 index bfc1404bd1478f2a7c475d55b53a70181506c4f8..b384af27839b7bb6e028baf817fe844c225963f5 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2375,7 +2375,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2378,7 +2378,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} }
// Spigot end // Spigot end
// this.chatSpamTickCount += 20; // this.chatSpamTickCount += 20;

View file

@ -85,10 +85,10 @@ index d088479d160dbd2fc90b48a30553be141db8eef2..ccb7d92b6c36b6225a2e640f8cea6c0d
public static class DataItem<T> { public static class DataItem<T> {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index bd5348f00249bf318bba308ef256ad42a69df7f0..1c3452cd2212dabfb16bd5d2b15863ab562ed520 100644 index 8b50f5da94766fdfc31b1b5f7d11795c2942ec72..dc01d6a09d369038677b5a0b61ad91594144ecd9 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2655,7 +2655,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2658,7 +2658,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Entity in bucket - SPIGOT-4048 and SPIGOT-6859a // Entity in bucket - SPIGOT-4048 and SPIGOT-6859a
if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) { if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) {

View file

@ -40,10 +40,10 @@ index 536f0c496ce36ca3248fc6eeac9bbd77214a36f9..5e24c1e712eb16d0d5343760a65310bd
while (iterator.hasNext()) { while (iterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 1c3452cd2212dabfb16bd5d2b15863ab562ed520..a7f3a5c054a3f48ab37822585bbc268bd551a63d 100644 index dc01d6a09d369038677b5a0b61ad91594144ecd9..bd72501df7b50c3bc35dd9dde02e632ffc8458f0 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3392,7 +3392,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3395,7 +3395,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator)); this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
} catch (ProfilePublicKey.ValidationException profilepublickey_b) { } catch (ProfilePublicKey.ValidationException profilepublickey_b) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Use single player info update packet on join
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index a1180623d885870bacb974d8128a61ab80403ab2..2c5870846a3833da3da899a60dd6a69a2e7b195a 100644 index ff1de6758bb6ba0bb41394c4c900cf03ef5bdc75..bd9a5ee3498085b5d117beae4f51093a0050b3f1 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3422,7 +3422,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3425,7 +3425,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.signedMessageDecoder = session.createMessageDecoder(this.player.getUUID()); this.signedMessageDecoder = session.createMessageDecoder(this.player.getUUID());
this.chatMessageChain.append(() -> { this.chatMessageChain.append(() -> {
this.player.setChatSession(session); this.player.setChatSession(session);

View file

@ -24,7 +24,7 @@ index 0e54e8faa48751a651b953bec72543a94edf74bc..aa1c6de4d6cb7bbca33d25895c54707d
UPDATE_GAME_MODE((serialized, buf) -> { UPDATE_GAME_MODE((serialized, buf) -> {
serialized.gameMode = GameType.byId(buf.readVarInt()); serialized.gameMode = GameType.byId(buf.readVarInt());
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index d48ea4f9d2968a4d8af426058d01cc17a090a1fa..aa1c1418559265deaf755d65c9d57e9592ee0a6e 100644 index bdac192dc1ca4038d7a54cebb1cc58a78081f682..156217773320b53842224c8f45c612808703236a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -287,6 +287,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -287,6 +287,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -49,7 +49,7 @@ index d48ea4f9d2968a4d8af426058d01cc17a090a1fa..aa1c1418559265deaf755d65c9d57e95
} }
public void resetPosition() { public void resetPosition() {
@@ -3420,6 +3428,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3423,6 +3431,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private void resetPlayerChatState(RemoteChatSession session) { private void resetPlayerChatState(RemoteChatSession session) {
this.chatSession = session; this.chatSession = session;

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add slot sanity checks in container clicks
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4510fbf86cc1b7b02f705ad9e304ace337604ffb..9d310fffc240582df2cea085ee962e7ecd814853 100644 index d6b46ea6ae3b61de9ac1f11c7e6426b059554d46..64255f7db85886421d5029766e8a6d1eadb94cff 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2987,6 +2987,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2990,6 +2990,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
break; break;
case SWAP: case SWAP:
if ((packet.getButtonNum() >= 0 && packet.getButtonNum() < 9) || packet.getButtonNum() == 40) { if ((packet.getButtonNum() >= 0 && packet.getButtonNum() < 9) || packet.getButtonNum() == 40) {