From 8125b3f1be6c191bd8b443679b2ecfda1b0ac286 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Sat, 12 Jun 2021 14:58:17 +0200 Subject: [PATCH] More more more work --- UPDATE_NOTES.md | 14 -------- .../0069-Add-PlayerJumpEvent.patch | 0 ...r-plugins-modifying-the-parent-of-t.patch} | 0 ...t-protocol-version-and-virtual-host.patch} | 2 +- ...imer-when-spawner-event-is-cancelled.patch | 12 +++++-- ...-prefixes-using-Log4J-configuration.patch} | 31 +++++++++++----- ...-Log4J-Configuration-Plugin-Loggers.patch} | 0 .../0159-Add-PlayerJumpEvent.patch} | 8 ++--- ...-handle-PacketPlayInKeepAlive-async.patch} | 6 ++-- ...t-protocol-version-and-virtual-host.patch} | 26 ++++---------- ...t-serverside-behavior-of-keepalives.patch} | 36 ++++++++++--------- ...Effects-only-to-players-who-can-see.patch} | 14 ++++---- 12 files changed, 73 insertions(+), 76 deletions(-) delete mode 100644 UPDATE_NOTES.md rename patches/{api-unmapped => api}/0069-Add-PlayerJumpEvent.patch (100%) rename patches/api/{0069-Add-workaround-for-plugins-modifying-the-parent-of-t.patch => 0070-Add-workaround-for-plugins-modifying-the-parent-of-t.patch} (100%) rename patches/{api-unmapped/0070-Expose-client-protocol-version-and-virtual-host.patch => api/0071-Expose-client-protocol-version-and-virtual-host.patch} (96%) rename patches/{server-remapped/0169-Handle-plugin-prefixes-using-Log4J-configuration.patch => server/0157-Handle-plugin-prefixes-using-Log4J-configuration.patch} (73%) rename patches/{server-remapped/0170-Improve-Log4J-Configuration-Plugin-Loggers.patch => server/0158-Improve-Log4J-Configuration-Plugin-Loggers.patch} (100%) rename patches/{server-remapped/0171-Add-PlayerJumpEvent.patch => server/0159-Add-PlayerJumpEvent.patch} (89%) rename patches/{server-remapped/0172-handle-PacketPlayInKeepAlive-async.patch => server/0160-handle-PacketPlayInKeepAlive-async.patch} (88%) rename patches/{server-remapped/0173-Expose-client-protocol-version-and-virtual-host.patch => server/0161-Expose-client-protocol-version-and-virtual-host.patch} (74%) rename patches/{server-remapped/0174-revert-serverside-behavior-of-keepalives.patch => server/0162-revert-serverside-behavior-of-keepalives.patch} (75%) rename patches/{server-remapped/0175-Send-attack-SoundEffects-only-to-players-who-can-see.patch => server/0163-Send-attack-SoundEffects-only-to-players-who-can-see.patch} (91%) diff --git a/UPDATE_NOTES.md b/UPDATE_NOTES.md deleted file mode 100644 index 23c915e195..0000000000 --- a/UPDATE_NOTES.md +++ /dev/null @@ -1,14 +0,0 @@ -# Shit to check - -* Mini: "Optimize World Server Map": Figure out how to fill PaperWorldMap, it needs a dim key which doesnt exist anymore? -* Mini: "MC-50319": fix if still works -* Make sure the flat bedrock setting doesn't do anything stupid -* Check DataBits foreach -* lighting is bork (load chunk, fly away, come back, everything or parts are black) -* chunk generation seems slow with a lot of it happening -* Fix IDE Debug JVM Flag for new versions of minecraft - -* Check if `PlayerEditBookEvent`: https://github.com/PaperMC/Paper/pull/1751 -The PlayerEditBookEvent is straight up not called anymore. -The method to call it must now be `PlayerConnection#a(List, int)` (CB bug). -The item is presumably edited with the new page contents before it ever reaches this method? \ No newline at end of file diff --git a/patches/api-unmapped/0069-Add-PlayerJumpEvent.patch b/patches/api/0069-Add-PlayerJumpEvent.patch similarity index 100% rename from patches/api-unmapped/0069-Add-PlayerJumpEvent.patch rename to patches/api/0069-Add-PlayerJumpEvent.patch diff --git a/patches/api/0069-Add-workaround-for-plugins-modifying-the-parent-of-t.patch b/patches/api/0070-Add-workaround-for-plugins-modifying-the-parent-of-t.patch similarity index 100% rename from patches/api/0069-Add-workaround-for-plugins-modifying-the-parent-of-t.patch rename to patches/api/0070-Add-workaround-for-plugins-modifying-the-parent-of-t.patch diff --git a/patches/api-unmapped/0070-Expose-client-protocol-version-and-virtual-host.patch b/patches/api/0071-Expose-client-protocol-version-and-virtual-host.patch similarity index 96% rename from patches/api-unmapped/0070-Expose-client-protocol-version-and-virtual-host.patch rename to patches/api/0071-Expose-client-protocol-version-and-virtual-host.patch index ff8f83ac14..755988a174 100644 --- a/patches/api-unmapped/0070-Expose-client-protocol-version-and-virtual-host.patch +++ b/patches/api/0071-Expose-client-protocol-version-and-virtual-host.patch @@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..7b2af1bd72dfbcf4e962a982940fc49b + +} diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 9cf7adf244335ac7dccbdf11f605a8c6910f7414..04f1a6513711dde8576c9b5c2b04619c56b48d8a 100644 +index 22cfa703e4f543c26151b33fe9ee1ab445d1c4fe..a32c4bd276de797f518771460083050fcddc4c5b 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable; diff --git a/patches/server/0155-Reset-spawner-timer-when-spawner-event-is-cancelled.patch b/patches/server/0155-Reset-spawner-timer-when-spawner-event-is-cancelled.patch index 65b65ad963..4c940a146a 100644 --- a/patches/server/0155-Reset-spawner-timer-when-spawner-event-is-cancelled.patch +++ b/patches/server/0155-Reset-spawner-timer-when-spawner-event-is-cancelled.patch @@ -5,10 +5,18 @@ Subject: [PATCH] Reset spawner timer when spawner event is cancelled diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index e310c1eb1108780bcff4d7ba9d49cefa2926287c..e3a69ed5ac791d8afb9c5beb924f9cf99dc0b410 100644 +index e310c1eb1108780bcff4d7ba9d49cefa2926287c..12a78685848b7fd945a472902d8200ea1d50b9ec 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java -@@ -190,7 +190,7 @@ public abstract class BaseSpawner { +@@ -167,6 +167,7 @@ public abstract class BaseSpawner { + // Spigot End + } + entity.spawnedViaMobSpawner = true; // Paper ++ flag = true; // Paper + // Spigot Start + if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { + Entity vehicle = entity.getVehicle(); +@@ -190,7 +191,7 @@ public abstract class BaseSpawner { ((Mob) entity).spawnAnim(); } diff --git a/patches/server-remapped/0169-Handle-plugin-prefixes-using-Log4J-configuration.patch b/patches/server/0157-Handle-plugin-prefixes-using-Log4J-configuration.patch similarity index 73% rename from patches/server-remapped/0169-Handle-plugin-prefixes-using-Log4J-configuration.patch rename to patches/server/0157-Handle-plugin-prefixes-using-Log4J-configuration.patch index 8c91986ef3..f95216ecdd 100644 --- a/patches/server-remapped/0169-Handle-plugin-prefixes-using-Log4J-configuration.patch +++ b/patches/server/0157-Handle-plugin-prefixes-using-Log4J-configuration.patch @@ -14,28 +14,41 @@ the root logger, the Minecraft/Mojang loggers and the Bukkit loggers. This may cause additional prefixes to be disabled for plugins bypassing the plugin logger. +diff --git a/build.gradle.kts b/build.gradle.kts +index 7d969b0c2a4c15c7c12ab1dd0b002a7b53cebeed..ac607a3be84bc02dedb95cab9a5eace40e33b511 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -30,7 +30,7 @@ dependencies { + all its classes to check if they are plugins. + Scanning takes about 1-2 seconds so adding this speeds up the server start. + */ +- runtimeOnly("org.apache.logging.log4j:log4j-core:2.14.1") ++ implementation("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - implementation + // Paper end + implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper + implementation("org.apache.logging.log4j:log4j-api:2.14.1") // Paper diff --git a/pom.xml b/pom.xml -index 3841fe3630c090f8a468333d43caeb2b5841329d..f5429f2f1979542fd93956d2f436d20d0e3a66b8 100644 +index 2f0e513c9e5d78a22e7d1e1a5aa64bb8f0f360d2..f5e74f74e32095c4ad1f8094a0dd64be8e193f0c 100644 --- a/pom.xml +++ b/pom.xml -@@ -76,7 +76,7 @@ - - org.apache.logging.log4j - log4j-core +@@ -68,7 +68,7 @@ + com.googlecode.json-simple + json-simple + 1.1.1 - runtime + compile - org.apache.logging.log4j + org.xerial diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 0083f979933d4a9035efb992ab0a2f250a56a979..3981ba5957fdc2929d54515f2b98bb7a4611e938 100644 +index 2d226fd06759ed92bf5591259fc86f34f606a3ec..e7586c325290ceb8669f9f9d430c73080a37dd05 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -290,7 +290,7 @@ public class SpigotConfig private static void playerSample() { - playerSample = getInt( "settings.sample-count", 12 ); -- System.out.println( "Server Ping Player Sample Count: " + playerSample ); + SpigotConfig.playerSample = SpigotConfig.getInt( "settings.sample-count", 12 ); +- System.out.println( "Server Ping Player Sample Count: " + SpigotConfig.playerSample ); + Bukkit.getLogger().log( Level.INFO, "Server Ping Player Sample Count: {0}", playerSample ); // Paper - Use logger } diff --git a/patches/server-remapped/0170-Improve-Log4J-Configuration-Plugin-Loggers.patch b/patches/server/0158-Improve-Log4J-Configuration-Plugin-Loggers.patch similarity index 100% rename from patches/server-remapped/0170-Improve-Log4J-Configuration-Plugin-Loggers.patch rename to patches/server/0158-Improve-Log4J-Configuration-Plugin-Loggers.patch diff --git a/patches/server-remapped/0171-Add-PlayerJumpEvent.patch b/patches/server/0159-Add-PlayerJumpEvent.patch similarity index 89% rename from patches/server-remapped/0171-Add-PlayerJumpEvent.patch rename to patches/server/0159-Add-PlayerJumpEvent.patch index 9abed7291f..7271b0ea7e 100644 --- a/patches/server-remapped/0171-Add-PlayerJumpEvent.patch +++ b/patches/server/0159-Add-PlayerJumpEvent.patch @@ -5,16 +5,16 @@ Subject: [PATCH] Add PlayerJumpEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 6a922e3522ac99a8e317a5f5f51fbb597baaf63e..f35a976de39f16d100bcbe411b64de357832c5df 100644 +index acee61af1b01c7e66c3b5c7e164ddd9a88e53606..049436f5cc373f6d076a62ae2b548b0154a43b78 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1166,7 +1166,34 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -1186,7 +1186,34 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser boolean flag = d8 > 0.0D; if (this.player.isOnGround() && !packet.isOnGround() && flag) { - this.player.jumpFromGround(); + // Paper start - Add player jump event -+ Player player = this.getPlayer(); ++ Player player = this.getCraftPlayer(); + Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location. + Location to = player.getLocation().clone(); // Start off the To location as the Players current location. + @@ -37,7 +37,7 @@ index 6a922e3522ac99a8e317a5f5f51fbb597baaf63e..f35a976de39f16d100bcbe411b64de35 + this.player.jumpFromGround(); + } else { + from = event.getFrom(); -+ this.internalTeleport(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch(), Collections.emptySet()); ++ this.internalTeleport(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch(), Collections.emptySet(), false); + return; + } + // Paper end diff --git a/patches/server-remapped/0172-handle-PacketPlayInKeepAlive-async.patch b/patches/server/0160-handle-PacketPlayInKeepAlive-async.patch similarity index 88% rename from patches/server-remapped/0172-handle-PacketPlayInKeepAlive-async.patch rename to patches/server/0160-handle-PacketPlayInKeepAlive-async.patch index 1a0b7f3089..0399cafb24 100644 --- a/patches/server-remapped/0172-handle-PacketPlayInKeepAlive-async.patch +++ b/patches/server/0160-handle-PacketPlayInKeepAlive-async.patch @@ -15,10 +15,10 @@ 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 f35a976de39f16d100bcbe411b64de357832c5df..f0aab8639c7d8440e4d70dd096200313d7958780 100644 +index 049436f5cc373f6d076a62ae2b548b0154a43b78..6049c63b4f7abde0840738638d4bf19172a01200 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2777,14 +2777,18 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -2781,14 +2781,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void handleKeepAlive(ServerboundKeepAlivePacket packet) { @@ -31,7 +31,7 @@ index f35a976de39f16d100bcbe411b64de357832c5df..f0aab8639c7d8440e4d70dd096200313 this.keepAlivePending = false; } else if (!this.isSingleplayerOwner()) { + // Paper start - This needs to be handled on the main thread for plugins -+ server.scheduleOnMain(() -> { ++ server.submit(() -> { this.disconnect(new TranslatableComponent("disconnect.timeout")); + }); + // Paper end diff --git a/patches/server-remapped/0173-Expose-client-protocol-version-and-virtual-host.patch b/patches/server/0161-Expose-client-protocol-version-and-virtual-host.patch similarity index 74% rename from patches/server-remapped/0173-Expose-client-protocol-version-and-virtual-host.patch rename to patches/server/0161-Expose-client-protocol-version-and-virtual-host.patch index c18295ef08..ca799c2b52 100644 --- a/patches/server-remapped/0173-Expose-client-protocol-version-and-virtual-host.patch +++ b/patches/server/0161-Expose-client-protocol-version-and-virtual-host.patch @@ -60,10 +60,10 @@ index 0000000000000000000000000000000000000000..a5a7624f1f372a26b982836cd31cff15 + +} diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 92c5c5bbcfe364475578b6a0eddfaa85858ace8a..3429c813a5b471cdfa561bd20849a303e5aacead 100644 +index 242f76a2ee2ca3d67851647bbb14cd123c378e0b..1d46187969b5792c255d0bf1966b427b905cb69c 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -70,6 +70,10 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -83,6 +83,10 @@ public class Connection extends SimpleChannelInboundHandler> { private float averageSentPackets; private int tickCount; private boolean handlingFault; @@ -74,20 +74,8 @@ index 92c5c5bbcfe364475578b6a0eddfaa85858ace8a..3429c813a5b471cdfa561bd20849a303 public Connection(PacketFlow side) { this.receiving = side; -diff --git a/src/main/java/net/minecraft/network/protocol/handshake/ClientIntentionPacket.java b/src/main/java/net/minecraft/network/protocol/handshake/ClientIntentionPacket.java -index 1eae2999ecc57f68ac9cd1d745191cba617b0de2..9ad400b15a2eb2d80bc763de28d648e22432b8f2 100644 ---- a/src/main/java/net/minecraft/network/protocol/handshake/ClientIntentionPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/handshake/ClientIntentionPacket.java -@@ -39,6 +39,7 @@ public class ClientIntentionPacket implements Packet= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected + ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info + this.disconnect(new TranslatableComponent("disconnect.timeout", new Object[0])); + } + } else { + if (elapsedTime >= 15000L) { // 15 seconds -+ this.setPendingPing(true); -+ this.setLastPing(currentTime); -+ this.setKeepAliveID(currentTime); -+ this.send(new ClientboundKeepAlivePacket(this.getKeepAliveID())); + this.keepAlivePending = true; +- this.keepAliveTime = i; +- this.keepAliveChallenge = i; ++ this.keepAliveTime = currentTime; ++ this.keepAliveChallenge = currentTime; + this.send(new ClientboundKeepAlivePacket(this.keepAliveChallenge)); } } + // Paper end diff --git a/patches/server-remapped/0175-Send-attack-SoundEffects-only-to-players-who-can-see.patch b/patches/server/0163-Send-attack-SoundEffects-only-to-players-who-can-see.patch similarity index 91% rename from patches/server-remapped/0175-Send-attack-SoundEffects-only-to-players-who-can-see.patch rename to patches/server/0163-Send-attack-SoundEffects-only-to-players-who-can-see.patch index d30ac6d736..d7dc1deef3 100644 --- a/patches/server-remapped/0175-Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/patches/server/0163-Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 3205bc2fb6c9031be68ff46dfca927e681163fa8..43868c1e2d2c858a4f02119c3238f615f9b1ee72 100644 +index 075bbc75d2e33be3a42c6c3ec279eeeba6408333..d3fe3eabf4465101760951113b23edf2ce03e57d 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -28,6 +28,7 @@ import net.minecraft.network.chat.MutableComponent; +@@ -30,6 +30,7 @@ import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket; @@ -17,7 +17,7 @@ index 3205bc2fb6c9031be68ff46dfca927e681163fa8..43868c1e2d2c858a4f02119c3238f615 import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; -@@ -1123,7 +1124,7 @@ public abstract class Player extends LivingEntity { +@@ -1183,7 +1184,7 @@ public abstract class Player extends LivingEntity { int i = b0 + EnchantmentHelper.getKnockbackBonus((LivingEntity) this); if (this.isSprinting() && flag) { @@ -26,7 +26,7 @@ index 3205bc2fb6c9031be68ff46dfca927e681163fa8..43868c1e2d2c858a4f02119c3238f615 ++i; flag1 = true; } -@@ -1198,7 +1199,7 @@ public abstract class Player extends LivingEntity { +@@ -1258,7 +1259,7 @@ public abstract class Player extends LivingEntity { } } @@ -35,7 +35,7 @@ index 3205bc2fb6c9031be68ff46dfca927e681163fa8..43868c1e2d2c858a4f02119c3238f615 this.sweepAttack(); } -@@ -1226,15 +1227,15 @@ public abstract class Player extends LivingEntity { +@@ -1286,15 +1287,15 @@ public abstract class Player extends LivingEntity { } if (flag2) { @@ -54,7 +54,7 @@ index 3205bc2fb6c9031be68ff46dfca927e681163fa8..43868c1e2d2c858a4f02119c3238f615 } } -@@ -1286,7 +1287,7 @@ public abstract class Player extends LivingEntity { +@@ -1346,7 +1347,7 @@ public abstract class Player extends LivingEntity { this.applyExhaustion(level.spigotConfig.combatExhaustion, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value } else { @@ -63,7 +63,7 @@ index 3205bc2fb6c9031be68ff46dfca927e681163fa8..43868c1e2d2c858a4f02119c3238f615 if (flag4) { target.clearFire(); } -@@ -1721,6 +1722,14 @@ public abstract class Player extends LivingEntity { +@@ -1793,6 +1794,14 @@ public abstract class Player extends LivingEntity { public int getXpNeededForNextLevel() { return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2); }