fix: fix build number check in version fetcher (#16)

This commit is contained in:
Noah van der Aa 2023-03-30 23:13:55 +02:00 committed by GitHub
parent 00cfbaa1c2
commit ed7a5c57f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 16 deletions

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Force disable timings
Need a new profiler system with region threading
diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java
index b5a86274925a9285f8f20ed7c54877207804419c..fdf5111c3ccd738c4380b517f64082c387b48469 100644
index 9812d668ad945aba486fbf6d5bf83c4292cb5d03..34386d6ce702de9a58f2892045563dd57ef46bbf 100644
--- a/src/main/java/co/aikar/timings/Timings.java
+++ b/src/main/java/co/aikar/timings/Timings.java
@@ -145,13 +145,14 @@ public final class Timings {

View File

@ -64,7 +64,7 @@ index 4b002e8b75d117b726b0de274a76d3596fce015b..58dc84b7b3b04c2d0b00fc5fac5303d3
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
index bf42969859545a8a520923ef1836ffa4a5cc24a0..719b0e318a85d4a1fb8f616deeb31193495b462e 100644
index bf42969859545a8a520923ef1836ffa4a5cc24a0..2ce29b6ccb9a3b520b8c1edf53aae2e9769ba252 100644
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
@@ -31,8 +31,8 @@ public class PaperVersionFetcher implements VersionFetcher {
@ -78,6 +78,15 @@ index bf42969859545a8a520923ef1836ffa4a5cc24a0..719b0e318a85d4a1fb8f616deeb31193
final Component history = getHistory();
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
@@ -85,7 +85,7 @@ public class PaperVersionFetcher implements VersionFetcher {
if (siteApiVersion == null) { return -1; }
try {
try (BufferedReader reader = Resources.asCharSource(
- new URL("https://api.papermc.io/v2/projects/paper/versions/" + siteApiVersion),
+ new URL("https://api.papermc.io/v2/projects/folia/versions/" + siteApiVersion), // Folia
Charsets.UTF_8
).openBufferedStream()) {
JsonObject json = new Gson().fromJson(reader, JsonObject.class);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 9f15d9dbdfa74a0640b1a2b4ff695609d4758a4c..3219482b96cab8262e393a790c88d903d7de5166 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java

View File

@ -16617,7 +16617,7 @@ index 44d99e89226adb6234b9405f25ac9dab9bd84297..072634e26d32ca0b3438a5d3a03be367
Collections.shuffle( this.connections );
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2d8488b9aa088b6d5f0c7e557b8ad0b29bc4cd88..aab6ffceaabecf8efa7f5d83f30a537a3f62c7bd 100644
index d587b2c4e39bce7e098aa9fab361230f72770658..85116d9a4538404bb7d5cbd8893637581132746a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -322,10 +322,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -16893,7 +16893,7 @@ index 2d8488b9aa088b6d5f0c7e557b8ad0b29bc4cd88..aab6ffceaabecf8efa7f5d83f30a537a
if ((quitMessage != null) && !quitMessage.equals(net.kyori.adventure.text.Component.empty())) {
this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false);
// Paper end
@@ -2193,9 +2210,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2194,9 +2211,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
// CraftBukkit end
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) {
@ -16905,7 +16905,7 @@ index 2d8488b9aa088b6d5f0c7e557b8ad0b29bc4cd88..aab6ffceaabecf8efa7f5d83f30a537a
} else {
Optional<LastSeenMessages> optional = this.tryHandleChat(packet.message(), packet.timeStamp(), packet.lastSeenMessages());
@@ -2229,17 +2246,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2230,17 +2247,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleChatCommand(ServerboundChatCommandPacket packet) {
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) {
@ -16927,7 +16927,7 @@ index 2d8488b9aa088b6d5f0c7e557b8ad0b29bc4cd88..aab6ffceaabecf8efa7f5d83f30a537a
}
}
@@ -2313,9 +2330,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2314,9 +2331,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private Optional<LastSeenMessages> tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
if (!this.updateChatOrder(timestamp)) {
ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}': {} > {}", this.player.getName().getString(), message, this.lastChatTimeStamp.get().getEpochSecond(), timestamp.getEpochSecond()); // Paper
@ -16939,7 +16939,7 @@ index 2d8488b9aa088b6d5f0c7e557b8ad0b29bc4cd88..aab6ffceaabecf8efa7f5d83f30a537a
return Optional.empty();
} else {
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(acknowledgment);
@@ -2390,7 +2407,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2391,7 +2408,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
String originalFormat = event.getFormat(), originalMessage = event.getMessage();
this.cserver.getPluginManager().callEvent(event);
@ -16948,7 +16948,7 @@ index 2d8488b9aa088b6d5f0c7e557b8ad0b29bc4cd88..aab6ffceaabecf8efa7f5d83f30a537a
// Evil plugins still listening to deprecated event
final PlayerChatEvent queueEvent = new PlayerChatEvent(player, event.getMessage(), event.getFormat(), event.getRecipients());
queueEvent.setCancelled(event.isCancelled());
@@ -2468,6 +2485,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2469,6 +2486,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
public void handleCommand(String s) { // Paper - private -> public
// Paper Start
if (!org.spigotmc.AsyncCatcher.shuttingDown && !org.bukkit.Bukkit.isPrimaryThread()) {
@ -16956,7 +16956,7 @@ index 2d8488b9aa088b6d5f0c7e557b8ad0b29bc4cd88..aab6ffceaabecf8efa7f5d83f30a537a
LOGGER.error("Command Dispatched Async: " + s);
LOGGER.error("Please notify author of plugin causing this execution to fix this bug! see: http://bit.ly/1oSiM6C", new Throwable());
Waitable<Void> wait = new Waitable<>() {
@@ -2528,6 +2546,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2529,6 +2547,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (s.isEmpty()) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send an empty message");
} else if (this.getCraftPlayer().isConversing()) {
@ -16964,7 +16964,7 @@ index 2d8488b9aa088b6d5f0c7e557b8ad0b29bc4cd88..aab6ffceaabecf8efa7f5d83f30a537a
final String conversationInput = s;
this.server.processQueue.add(new Runnable() {
@Override
@@ -2769,7 +2788,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2770,7 +2789,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.player.resetLastActionTime();
this.player.setShiftKeyDown(packet.isUsingSecondaryAction());
@ -16973,7 +16973,7 @@ index 2d8488b9aa088b6d5f0c7e557b8ad0b29bc4cd88..aab6ffceaabecf8efa7f5d83f30a537a
if (!worldserver.getWorldBorder().isWithinBounds(entity.blockPosition())) {
return;
}
@@ -2909,6 +2928,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2910,6 +2929,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
switch (packetplayinclientcommand_enumclientcommand) {
case PERFORM_RESPAWN:
if (this.player.wonGame) {
@ -16986,7 +16986,7 @@ index 2d8488b9aa088b6d5f0c7e557b8ad0b29bc4cd88..aab6ffceaabecf8efa7f5d83f30a537a
this.player.wonGame = false;
this.player = this.server.getPlayerList().respawn(this.player, this.server.getLevel(this.player.getRespawnDimension()), true, null, true, org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag.END_PORTAL); // Paper - add isEndCreditsRespawn argument
CriteriaTriggers.CHANGED_DIMENSION.trigger(this.player, Level.END, Level.OVERWORLD);
@@ -2917,6 +2942,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2918,6 +2943,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
return;
}
@ -17005,7 +17005,7 @@ index 2d8488b9aa088b6d5f0c7e557b8ad0b29bc4cd88..aab6ffceaabecf8efa7f5d83f30a537a
this.player = this.server.getPlayerList().respawn(this.player, false);
if (this.server.isHardcore()) {
this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper
@@ -3269,7 +3306,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3270,7 +3307,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Paper start
if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
@ -17014,7 +17014,7 @@ index 2d8488b9aa088b6d5f0c7e557b8ad0b29bc4cd88..aab6ffceaabecf8efa7f5d83f30a537a
return;
}
}
@@ -3411,7 +3448,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3412,7 +3449,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.filterTextPacket(list).thenAcceptAsync((list1) -> {
this.updateSignText(packet, list1);
@ -17029,7 +17029,7 @@ index 2d8488b9aa088b6d5f0c7e557b8ad0b29bc4cd88..aab6ffceaabecf8efa7f5d83f30a537a
}
private void updateSignText(ServerboundSignUpdatePacket packet, List<FilteredText> signText) {
@@ -3481,9 +3524,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3482,9 +3525,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.keepAlivePending = false;
} else if (!this.isSingleplayerOwner()) {
// Paper start - This needs to be handled on the main thread for plugins

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Work around https://github.com/PaperMC/paperweight/issues/194
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index aab6ffceaabecf8efa7f5d83f30a537a3f62c7bd..b0e978c4424b6eaacaa629958f1372c776a5f59b 100644
index 85116d9a4538404bb7d5cbd8893637581132746a..96203bd4d7af425236db220b746a9dcba38bfd08 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -494,7 +494,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic