Fix some references to obfuscated code

This commit is contained in:
Nassim Jahnke 2022-06-11 11:02:09 +02:00
parent 1ccff4f5d1
commit d7165b0d56
No known key found for this signature in database
GPG key ID: 6BE3B555EBC5982B
8 changed files with 23 additions and 24 deletions

View file

@ -2412,7 +2412,7 @@ index 7fa6212fca01af9efd787f2c74af986fbeef4a77..b403022201b34118adddf817b19a8bbd
@Override
public boolean isPermissionSet(String name) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 56151652fdeb98f54358cfefc3d8773c1a39fcf6..2099056896954c700840f3c598f147e4983b86a1 100644
index 56151652fdeb98f54358cfefc3d8773c1a39fcf6..2c934b7a2142a4d1ae21feeb95d23f22cfda3be0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -318,9 +318,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@ -2425,7 +2425,7 @@ index 56151652fdeb98f54358cfefc3d8773c1a39fcf6..2099056896954c700840f3c598f147e4
+ if (adventure$title == null) adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(container.getBukkitView().getTitle()); // Paper
- player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, CraftChatMessage.fromString(title)[0]));
+ //player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); // Paper // Paper - comment
+ //player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, CraftChatMessage.fromString(title)[0])); // Paper - comment
+ player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper
player.containerMenu = container;
player.initMenu(container);
@ -2440,7 +2440,7 @@ index 56151652fdeb98f54358cfefc3d8773c1a39fcf6..2099056896954c700840f3c598f147e4
+ //String title = inventory.getTitle(); // Paper - comment
+ net.kyori.adventure.text.Component adventure$title = inventory.title(); // Paper
+ if (adventure$title == null) adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(inventory.getTitle()); // Paper
+ //player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); // Paper - comment
+ //player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, CraftChatMessage.fromString(title)[0])); // Paper - comment
+ player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper
player.containerMenu = container;
player.initMenu(container);

View file

@ -1,9 +1,9 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Thu, 5 Oct 2017 01:54:07 +0100
Subject: [PATCH] handle PacketPlayInKeepAlive async
Subject: [PATCH] handle ServerboundKeepAlivePacket async
In 1.12.2, Mojang moved the processing of PacketPlayInKeepAlive off the main
In 1.12.2, Mojang moved the processing of ServerboundKeepAlivePacket off the main
thread, while entirely correct for the server, this causes issues with
plugins which are expecting the PlayerQuitEvent on the main thread.
@ -15,7 +15,7 @@ also adding some additional logging in order to help work out what is causing
random disconnections for clients.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index c5ab3ee4525f8eb611f273ff35d1b91787bc95b8..32c59e612519323c8ee1956a1a893354913d1fda 100644
index c5ab3ee4525f8eb611f273ff35d1b91787bc95b8..a38061ba575a2603b6b04382cb2f5c8396b05bdd 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2996,14 +2996,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -23,7 +23,7 @@ index c5ab3ee4525f8eb611f273ff35d1b91787bc95b8..32c59e612519323c8ee1956a1a893354
@Override
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
- PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // CraftBukkit
+ //PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.getWorldServer()); // CraftBukkit // Paper - This shouldn't be on the main thread
+ //PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // CraftBukkit // Paper - This shouldn't be on the main thread
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
int i = (int) (Util.getMillis() - this.keepAliveTime);

View file

@ -14,7 +14,7 @@ completion, such as offline players.
Also adds isCommand and getLocation to the sync TabCompleteEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 71e52f71ac06f66696f5ae9b79ab490c7389927f..cd9f1bea29833c0d263d43f4a8c76908c0c54b89 100644
index 86f9991cfe6aca5923c64d8cdde6e90b9ba5591d..7f17875e359855a25618a52bc2e844fe10258aaf 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -741,10 +741,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -22,7 +22,7 @@ index 71e52f71ac06f66696f5ae9b79ab490c7389927f..cd9f1bea29833c0d263d43f4a8c76908
@Override
public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) {
- PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
+ // PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async
+ // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // Paper - run this async
// CraftBukkit start
if (this.chatSpamTickCount.addAndGet(1) > 500 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
- this.disconnect(Component.translatable("disconnect.spam"));
@ -72,7 +72,7 @@ index 71e52f71ac06f66696f5ae9b79ab490c7389927f..cd9f1bea29833c0d263d43f4a8c76908
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index eed64dedb3430bd01c53c230c280a7c475fdbfd5..3f84c3579b1b37f98120d20bae008a1030b93adf 100644
index e674b45ee77480cd3c1da86b6f32a3ff2edd865f..c699d1eecac2b3f87f89b2e801ab909f863233b2 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2060,7 +2060,7 @@ public final class CraftServer implements Server {

View file

@ -75,7 +75,7 @@ index 05b9595d4d308e5b4a551d26f3defbfa1d829ea9..0ef0b7fa2af5ac6608f9b8b37317434f
this.doCloseContainer();
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2d6bb5e7dee7a0e7ddaf6e05a9a1f9df9f1d195d..c91e8300fe0cb673567f0b0e725a6d460dcebf31 100644
index d729042a22f01decbf30d35d7842e43cab283c05..8b9e569ccefaa5123c966590a9bba77cc8eec64d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -204,6 +204,7 @@ import org.bukkit.event.inventory.ClickType;
@ -90,13 +90,12 @@ index 2d6bb5e7dee7a0e7ddaf6e05a9a1f9df9f1d195d..c91e8300fe0cb673567f0b0e725a6d46
@Override
public void handleContainerClose(ServerboundContainerClosePacket packet) {
- PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
+ // Paper start
+ handleContainerClose(packet, InventoryCloseEvent.Reason.PLAYER);
+ }
+ public void handleContainerClose(ServerboundContainerClosePacket packetplayinclosewindow, InventoryCloseEvent.Reason reason) {
+ public void handleContainerClose(ServerboundContainerClosePacket packet, InventoryCloseEvent.Reason reason) {
+ // Paper end
+ PacketUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.getLevel());
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (this.player.isImmobile()) return; // CraftBukkit
- CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit
@ -145,7 +144,7 @@ index f484bdf2ef045faefad326f8e6d59962b3abb4b3..9dad71368225d86598f02962b42659bc
this.containerMenu = this.inventoryMenu;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 34e8ee0cc42c77715c62b0b4682f3df946266e11..6abac92f929f3260e62a78b0ee1887b109b0cc25 100644
index 4ff81744b7c9113f57cf1fa89bb943902711b2dc..404ed5e8f54d70a50de4232c6ea0f6163b34c2ab 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -374,7 +374,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {

View file

@ -22,7 +22,7 @@ to take the burden of this into their own hand without having to rely on
plugins doing unsafe things.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4b99de786be5fbefb94a5484868b897ab0f86a27..e0215f34f5f82cbd3a67f58a8a177fc886ccc72c 100644
index ff79bb6e51d8c7e4b61509f7cf95b1282e7a844e..14b102e8341d4cb10935e9d247d7451661a02017 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -246,6 +246,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -43,7 +43,7 @@ index 4b99de786be5fbefb94a5484868b897ab0f86a27..e0215f34f5f82cbd3a67f58a8a177fc8
--this.chatSpamTickCount;
@@ -744,7 +746,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) {
// PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // Paper - run this async
// CraftBukkit start
- if (this.chatSpamTickCount.addAndGet(1) > 500 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
+ if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable

View file

@ -27,13 +27,13 @@ index 3933387e180acc0fcbff1c1147fcf73eeaa8b0d7..02a84c3f3ca6b591a1c475b5cf3357ce
this.initMenu(container);
return OptionalInt.of(this.containerCounter);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 6abac92f929f3260e62a78b0ee1887b109b0cc25..9d6c3cb06cf1096fc9bffe5123bf19df13fdded6 100644
index 404ed5e8f54d70a50de4232c6ea0f6163b34c2ab..3866c466fcc40f17f88063acb939f9091708a92f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -323,7 +323,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
if (adventure$title == null) adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(container.getBukkitView().getTitle()); // Paper
//player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); // Paper // Paper - comment
//player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, CraftChatMessage.fromString(title)[0])); // Paper - comment
- player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper
+ if (!player.isImmobile()) player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper
player.containerMenu = container;
@ -42,7 +42,7 @@ index 6abac92f929f3260e62a78b0ee1887b109b0cc25..9d6c3cb06cf1096fc9bffe5123bf19df
@@ -397,7 +397,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
net.kyori.adventure.text.Component adventure$title = inventory.title(); // Paper
if (adventure$title == null) adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(inventory.getTitle()); // Paper
//player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); // Paper - comment
//player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, CraftChatMessage.fromString(title)[0])); // Paper - comment
- player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper
+ if (!player.isImmobile()) player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper
player.containerMenu = container;

View file

@ -27,7 +27,7 @@ index 3768a71491ef7836b9739bdaec7a077c523dbacd..a57957ace1a72b3308487f180a366c38
public Vec3 decode(long x, long y, long z) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 6b49e66f0e45eb7ed525fe4314d2a9615212f7e4..4f9a5837d66c1940385e94f80d865cde1c4cf2a2 100644
index 6b49e66f0e45eb7ed525fe4314d2a9615212f7e4..b537edf3c219f5064733eec53082db577be51f81 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3888,6 +3888,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@ -37,7 +37,7 @@ index 6b49e66f0e45eb7ed525fe4314d2a9615212f7e4..4f9a5837d66c1940385e94f80d865cde
+ // Paper start - fix MC-4
+ if (this instanceof ItemEntity) {
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.fixEntityPositionDesync) {
+ // encode/decode from PacketPlayOutEntity
+ // encode/decode from ClientboundMoveEntityPacket
+ x = Mth.lfloor(x * 4096.0D) * (1 / 4096.0D);
+ y = Mth.lfloor(y * 4096.0D) * (1 / 4096.0D);
+ z = Mth.lfloor(z * 4096.0D) * (1 / 4096.0D);

View file

@ -57,7 +57,7 @@ index 65637a33ba171a4b598f70cd943d24b0ee44a69f..57a9146bf2dee7a60aab16716e25348f
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b5b130785cb0009f58b65b1cc4dba9f006ba1d7a..4e356271ba54d51c4778314c86495136bfbd8704 100644
index f3a8b36956dbb8b9396bac4fc17aae7a3cb1d594..c8e99e115c0c40834cc73c8373bb757ea7e1e88f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -344,7 +344,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -141,7 +141,7 @@ index b5b130785cb0009f58b65b1cc4dba9f006ba1d7a..4e356271ba54d51c4778314c86495136
Entity entity = this.player.getRootVehicle();
@@ -784,13 +792,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // Paper - run this async
// CraftBukkit start
if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable
- server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper