Add numeric string completion suggestions as int suggestions (#6360)

This commit is contained in:
Emily 2022-06-01 22:56:24 -03:00 committed by GitHub
parent c5caee307e
commit 71fe3c64f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 48 additions and 47 deletions

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Allow for Component suggestion tooltips in
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 424b7df06f98bb5157b91026854e03cd8c4e3deb..c1a01129070f20bc7f17929b2683bd9ed1591961 100644 index 424b7df06f98bb5157b91026854e03cd8c4e3deb..171fb8361c688080c2cf29788433c3d87bf3864e 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
@@ -771,12 +771,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -771,12 +771,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -24,7 +24,7 @@ index 424b7df06f98bb5157b91026854e03cd8c4e3deb..c1a01129070f20bc7f17929b2683bd9e
// If the event isn't handled, we can assume that we have no completions, and so we'll ask the server // If the event isn't handled, we can assume that we have no completions, and so we'll ask the server
if (!event.isHandled()) { if (!event.isHandled()) {
if (!event.isCancelled()) { if (!event.isCancelled()) {
@@ -795,10 +794,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -795,10 +794,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}); });
} }
} else if (!completions.isEmpty()) { } else if (!completions.isEmpty()) {
@ -35,8 +35,9 @@ index 424b7df06f98bb5157b91026854e03cd8c4e3deb..c1a01129070f20bc7f17929b2683bd9e
- completions.forEach(builder::suggest); - completions.forEach(builder::suggest);
+ final com.mojang.brigadier.suggestion.SuggestionsBuilder builder = builder0.createOffset(builder0.getInput().lastIndexOf(' ') + 1); + final com.mojang.brigadier.suggestion.SuggestionsBuilder builder = builder0.createOffset(builder0.getInput().lastIndexOf(' ') + 1);
+ completions.forEach(completion -> { + completions.forEach(completion -> {
+ if (completion.tooltip() == null) { + final Integer intSuggestion = com.google.common.primitives.Ints.tryParse(completion.suggestion());
+ builder.suggest(completion.suggestion()); + if (intSuggestion != null) {
+ builder.suggest(intSuggestion, PaperAdventure.asVanilla(completion.tooltip()));
+ } else { + } else {
+ builder.suggest(completion.suggestion(), PaperAdventure.asVanilla(completion.tooltip())); + builder.suggest(completion.suggestion(), PaperAdventure.asVanilla(completion.tooltip()));
+ } + }

View File

@ -5,10 +5,10 @@ Subject: [PATCH] fix PlayerItemHeldEvent firing twice
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 c1a01129070f20bc7f17929b2683bd9ed1591961..6e5394d50309dbdfc378ac5d16e75d5cac99cd61 100644 index 171fb8361c688080c2cf29788433c3d87bf3864e..b1e62c8c7f53ea30f190f689ebeac14212534181 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
@@ -1963,6 +1963,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1964,6 +1964,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (this.player.isImmobile()) return; // CraftBukkit if (this.player.isImmobile()) return; // CraftBukkit
if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) { if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) {

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 6e5394d50309dbdfc378ac5d16e75d5cac99cd61..20a1c0e3926e3853c74e0d6484333bca02c76a2f 100644 index b1e62c8c7f53ea30f190f689ebeac14212534181..f50c2d827504ce7ef724574dbd2126d5f8c960b3 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
@@ -2501,7 +2501,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2502,7 +2502,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
case PERFORM_RESPAWN: case PERFORM_RESPAWN:
if (this.player.wonGame) { if (this.player.wonGame) {
this.player.wonGame = false; this.player.wonGame = false;

View File

@ -126,10 +126,10 @@ index f97d97426144527cff9ebb91b26fe8541a9c6d9b..b6eef41079120fffd63f06f681378b1b
} }
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 25b9a0327241c28738cd36ae7cfd031dff93f4cc..eab35ca61dd44d03ad0b9851d0e878480aba104a 100644 index f50c2d827504ce7ef724574dbd2126d5f8c960b3..6ba3c1dcf797440e0677675a4869de25b567b945 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
@@ -2510,7 +2510,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2511,7 +2511,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player = this.server.getPlayerList().respawn(this.player, false); this.player = this.server.getPlayerList().respawn(this.player, false);
if (this.server.isHardcore()) { if (this.server.isHardcore()) {

View File

@ -156,7 +156,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
return; return;
} }
// Paper end // Paper end
@@ -910,7 +918,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -911,7 +919,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Paper start - validate pick item position // Paper start - validate pick item position
if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) { if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -165,7 +165,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
return; return;
} }
this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
@@ -1075,7 +1083,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1076,7 +1084,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
if (byteLength > 256 * 4) { if (byteLength > 256 * 4) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!"); ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!");
@ -174,7 +174,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
return; return;
} }
byteTotal += byteLength; byteTotal += byteLength;
@@ -1098,14 +1106,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1099,14 +1107,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (byteTotal > byteAllowed) { if (byteTotal > byteAllowed) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size()); ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
@ -191,7 +191,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
return; return;
} }
this.lastBookTick = MinecraftServer.currentTick; this.lastBookTick = MinecraftServer.currentTick;
@@ -1229,7 +1237,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1230,7 +1238,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
public void handleMovePlayer(ServerboundMovePlayerPacket packet) { public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) { if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) {
@ -200,7 +200,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
} else { } else {
ServerLevel worldserver = this.player.getLevel(); ServerLevel worldserver = this.player.getLevel();
@@ -1656,7 +1664,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1657,7 +1665,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.dropCount++; this.dropCount++;
if (this.dropCount >= 20) { if (this.dropCount >= 20) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!"); ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!");
@ -209,7 +209,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
return; return;
} }
} }
@@ -1875,7 +1883,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1876,7 +1884,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) { if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName()); ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
@ -218,7 +218,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
} }
// Paper start // Paper start
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()]; PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()];
@@ -1980,7 +1988,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1981,7 +1989,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.resetLastActionTime(); this.player.resetLastActionTime();
} else { } else {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -227,7 +227,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
} }
} }
@@ -1996,7 +2004,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1997,7 +2005,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
for (int i = 0; i < s.length(); ++i) { for (int i = 0; i < s.length(); ++i) {
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
@ -236,7 +236,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
return; return;
} }
} }
@@ -2069,7 +2077,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2070,7 +2078,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
Waitable waitable = new Waitable() { Waitable waitable = new Waitable() {
@Override @Override
protected Object evaluate() { protected Object evaluate() {
@ -245,7 +245,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
return null; return null;
} }
}; };
@@ -2084,7 +2092,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2085,7 +2093,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} else { } else {
@ -254,7 +254,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
} }
// CraftBukkit end // CraftBukkit end
} }
@@ -2357,7 +2365,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2358,7 +2366,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Spigot Start // Spigot Start
if ( entity == this.player && !this.player.isSpectator() ) if ( entity == this.player && !this.player.isSpectator() )
{ {
@ -263,7 +263,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
return; return;
} }
// Spigot End // Spigot End
@@ -2452,7 +2460,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2453,7 +2461,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }
// CraftBukkit end // CraftBukkit end
} else { } else {
@ -272,7 +272,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
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());
} }
} }
@@ -2858,7 +2866,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2859,7 +2867,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Paper start // Paper start
if (!org.bukkit.Bukkit.isPrimaryThread()) { if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) { if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) {
@ -281,7 +281,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
return; return;
} }
} }
@@ -3046,7 +3054,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -3047,7 +3055,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} else if (!this.isSingleplayerOwner()) { } else if (!this.isSingleplayerOwner()) {
// Paper start - This needs to be handled on the main thread for plugins // Paper start - This needs to be handled on the main thread for plugins
server.submit(() -> { server.submit(() -> {
@ -290,7 +290,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
}); });
// Paper end // Paper end
} }
@@ -3092,7 +3100,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -3093,7 +3101,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
@ -299,7 +299,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
} }
} else if (packet.identifier.equals(CUSTOM_UNREGISTER)) { } else if (packet.identifier.equals(CUSTOM_UNREGISTER)) {
try { try {
@@ -3102,7 +3110,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -3103,7 +3111,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
@ -308,7 +308,7 @@ index eab35ca61dd44d03ad0b9851d0e878480aba104a..b1a5df7e62bc2505bc95933cbdbf6e8b
} }
} else { } else {
try { try {
@@ -3120,7 +3128,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -3121,7 +3129,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data); this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Ensure disconnect for book edit is called on main
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 7ad1b8b836d692b1168609e96e4eb72e037be4c9..9186a593c787afc40a69cd442a27622fef6fa986 100644 index 9be0dbdd7d06568e9604fe18e5d4dd9f5d4a14be..d6279614b94afa8419a163305f5b23b1f36c10b2 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
@@ -1113,7 +1113,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1114,7 +1114,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Paper end // Paper end
// CraftBukkit start // CraftBukkit start
if (this.lastBookTick + 20 > MinecraftServer.currentTick) { if (this.lastBookTick + 20 > MinecraftServer.currentTick) {

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 9186a593c787afc40a69cd442a27622fef6fa986..f6c8ce420c8cbe977897c78f1575b917ee9632ac 100644 index d6279614b94afa8419a163305f5b23b1f36c10b2..f14f8c4db697f0101158f0024c9c91814f4c942e 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
@@ -2261,7 +2261,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2262,7 +2262,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }
// Arm swing animation // Arm swing animation

View File

@ -17,7 +17,7 @@ index 7ae525803609f173c0a38b17d2ef86c1facbd5dc..3a44756d9e71a56293f41ec9aab141ba
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
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 f6c8ce420c8cbe977897c78f1575b917ee9632ac..d9eec6be067b858001c31f25788a63f2d50051ce 100644 index f14f8c4db697f0101158f0024c9c91814f4c942e..88416fe604ccc136230f8743ea7a789b15d6c46d 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
@@ -447,7 +447,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -447,7 +447,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -37,7 +37,7 @@ index f6c8ce420c8cbe977897c78f1575b917ee9632ac..d9eec6be067b858001c31f25788a63f2
this.connection.setReadOnly(); this.connection.setReadOnly();
MinecraftServer minecraftserver = this.server; MinecraftServer minecraftserver = this.server;
Connection networkmanager = this.connection; Connection networkmanager = this.connection;
@@ -1908,6 +1907,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1909,6 +1908,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@Override @Override
public void onDisconnect(Component reason) { public void onDisconnect(Component reason) {
@ -49,7 +49,7 @@ index f6c8ce420c8cbe977897c78f1575b917ee9632ac..d9eec6be067b858001c31f25788a63f2
// CraftBukkit start - Rarely it would send a disconnect line twice // CraftBukkit start - Rarely it would send a disconnect line twice
if (this.processedDisconnect) { if (this.processedDisconnect) {
return; return;
@@ -1924,7 +1928,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1925,7 +1929,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.disconnect(); this.player.disconnect();
// Paper start - Adventure // Paper start - Adventure

View File

@ -88,7 +88,7 @@ index cc0adbd20bc069e61fc333e57c2e3ccbf8d5c888..fb15e7ec56b91541a4bff810d45edec5
} }
@Override @Override
@@ -1251,7 +1285,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1252,7 +1286,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }
if (this.awaitingPositionFromClient != null) { if (this.awaitingPositionFromClient != null) {
@ -97,7 +97,7 @@ index cc0adbd20bc069e61fc333e57c2e3ccbf8d5c888..fb15e7ec56b91541a4bff810d45edec5
this.awaitingTeleportTime = this.tickCount; this.awaitingTeleportTime = this.tickCount;
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot()); this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
} }
@@ -1345,7 +1379,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1346,7 +1380,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }
} }
@ -106,7 +106,7 @@ index cc0adbd20bc069e61fc333e57c2e3ccbf8d5c888..fb15e7ec56b91541a4bff810d45edec5
d7 = d0 - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above d7 = d0 - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above
d8 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above d8 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above
@@ -1386,6 +1420,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1387,6 +1421,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
boolean flag1 = this.player.verticalCollisionBelow; boolean flag1 = this.player.verticalCollisionBelow;
this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9)); this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9));
@ -114,7 +114,7 @@ index cc0adbd20bc069e61fc333e57c2e3ccbf8d5c888..fb15e7ec56b91541a4bff810d45edec5
this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move
// Paper start - prevent position desync // Paper start - prevent position desync
if (this.awaitingPositionFromClient != null) { if (this.awaitingPositionFromClient != null) {
@@ -1405,12 +1440,23 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1406,12 +1441,23 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
boolean flag2 = false; boolean flag2 = false;
if (!this.player.isChangingDimension() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot if (!this.player.isChangingDimension() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot
@ -140,7 +140,7 @@ index cc0adbd20bc069e61fc333e57c2e3ccbf8d5c888..fb15e7ec56b91541a4bff810d45edec5
this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet(), false); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet. this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet(), false); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet.
} else { } else {
// CraftBukkit start - fire PlayerMoveEvent // CraftBukkit start - fire PlayerMoveEvent
@@ -1496,6 +1542,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1497,6 +1543,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }
} }

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Kick on main for illegal chars
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 761a87be91e82841632f4f46dec799ae28f05887..d18f8972d37dc56a8df786774a4f70b5c3b78ec4 100644 index 09c86449f1e1fe06b75537251f91fc6063e7c7c4..4782ca794273c8a3fd53cf05732afd71ea376721 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
@@ -2080,7 +2080,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2081,7 +2081,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
for (int i = 0; i < s.length(); ++i) { for (int i = 0; i < s.length(); ++i) {
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {

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 1d30776997dda6998d793541bde9410030e25db1..c087d7a1f5e560193f87a681101da8be1b60c8b3 100644 index 428fb4e57956b52eb139c0f2e76c85f1c893920f..1ab83b8ef05ef8dfdabb17f33cffa728d631dff2 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
@@ -2994,7 +2994,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2995,7 +2995,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (!itemstack.isEmpty() && nbttagcompound != null && nbttagcompound.contains("x") && nbttagcompound.contains("y") && nbttagcompound.contains("z") && this.player.getBukkitEntity().hasPermission("minecraft.nbt.copy")) { // Spigot if (!itemstack.isEmpty() && nbttagcompound != null && nbttagcompound.contains("x") && nbttagcompound.contains("y") && nbttagcompound.contains("z") && this.player.getBukkitEntity().hasPermission("minecraft.nbt.copy")) { // Spigot
BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound); BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound);

View File

@ -18,10 +18,10 @@ index e28e09aae1d95d9bed50a137e999e6d457e62478..257c94f7c1cb00c9a91ab82e311dfd8e
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 c087d7a1f5e560193f87a681101da8be1b60c8b3..1a87f61d534ed531132fb43a9d2a45a4b604a6fc 100644 index 1ab83b8ef05ef8dfdabb17f33cffa728d631dff2..829842f40f5587aa4135ce4f2688e3acfe17a3da 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
@@ -2603,7 +2603,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2604,7 +2604,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player = this.server.getPlayerList().respawn(this.player, false); this.player = this.server.getPlayerList().respawn(this.player, false);
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 1a87f61d534ed531132fb43a9d2a45a4b604a6fc..1a1f3664554ae1f2b0110f615e79fa0568407d17 100644 index 0545c7fb227665dd23c7b5034a1520ed10f962b9..901fa17d0f0a3f66923f68f13f183bc4c17f7748 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
@@ -3169,6 +3169,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -3170,6 +3170,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@Override @Override
public void handleClientInformation(ServerboundClientInformationPacket packet) { public void handleClientInformation(ServerboundClientInformationPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());