diff --git a/gradle.properties b/gradle.properties index 55df86c..82b73ba 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ group=me.totalfreedom.scissors version=1.20.4-R0.1-SNAPSHOT mcVersion=1.20.4 -paperRef=b4c9e7e5d40fd4a0a7fea270fd4ebb72b38fa0fc +paperRef=5e978d3a3d2c8068ea152ea5a38938f1f8c15d94 org.gradle.caching=true org.gradle.parallel=true diff --git a/patches/server/0001-Build-changes.patch b/patches/server/0001-Build-changes.patch index 6011a28..20bf983 100644 --- a/patches/server/0001-Build-changes.patch +++ b/patches/server/0001-Build-changes.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Build changes diff --git a/build.gradle.kts b/build.gradle.kts -index b12b5a1e82a5ebf47135a3863a390a45a9d8d8ec..85907e6e85bd6b84d17496a2f631206afb318504 100644 +index 58da26ad2f128ba0b66f86820f60853f4be352f0..94a75d6ff937f178711bff7ca32d96506d4e0673 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -27,8 +27,12 @@ repositories { +@@ -13,8 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { + val alsoShade: Configuration by configurations.creating dependencies { - extraRuntime(platform("net.kyori:adventure-bom:4.15.0-SNAPSHOT")) - implementation(project(":paper-api")) - implementation(project(":paper-mojangapi")) + // Scissors start @@ -23,7 +23,7 @@ index b12b5a1e82a5ebf47135a3863a390a45a9d8d8ec..85907e6e85bd6b84d17496a2f631206a // Paper start implementation("org.jline:jline-terminal-jansi:3.21.0") implementation("net.minecrell:terminalconsoleappender:1.3.0") -@@ -80,11 +84,19 @@ tasks.jar { +@@ -66,11 +70,19 @@ tasks.jar { val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim() val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\"" val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper @@ -45,7 +45,7 @@ index b12b5a1e82a5ebf47135a3863a390a45a9d8d8ec..85907e6e85bd6b84d17496a2f631206a "Implementation-Vendor" to date, // Paper "Specification-Title" to "Bukkit", "Specification-Version" to project.version, -@@ -168,7 +180,7 @@ fun TaskContainer.registerRunTask( +@@ -154,7 +166,7 @@ fun TaskContainer.registerRunTask( name: String, block: JavaExec.() -> Unit ): TaskProvider = register(name) { @@ -108,7 +108,7 @@ index 34f19ac897a30c0c4e3ab406013fcca1c8b7db93..6f284b7cd52ea47bd96ecd3b7a21d68a public SystemReport fillSystemReport(SystemReport details) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index e011cfcdda2e0a609d4158b0454bdf046b04c9d9..856ebd326f9c91591fe293aefb4d1dc93af52ea0 100644 +index 142d2c48239d4ebe3896218536656d116cd24d7c..c97079981e19ebd3e47e650e5e04f2c213bbff41 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -264,7 +264,7 @@ import javax.annotation.Nullable; // Paper diff --git a/patches/server/0005-Removes-useless-spammy-error-logging.patch b/patches/server/0005-Removes-useless-spammy-error-logging.patch index 583be99..40bab92 100644 --- a/patches/server/0005-Removes-useless-spammy-error-logging.patch +++ b/patches/server/0005-Removes-useless-spammy-error-logging.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Removes useless spammy error logging diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 2ded472dbf0ed5ad3205e1dc8cbb20e1482a6ff6..a2fed3fd711bf906cf066a41ad1f187f02b13551 100644 +index 182bc05a839781794188352120968fdf67e794e7..98118cadae93000192003b40e9051a6df216d197 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -1814,8 +1814,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1812,8 +1812,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { resource = CraftNamespacedKey.fromMinecraft(key); } } catch (IllegalArgumentException ex) { diff --git a/patches/server/0021-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch b/patches/server/0021-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch index 6d3a18f..5d17e00 100644 --- a/patches/server/0021-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch +++ b/patches/server/0021-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Limit amount of vehicle collision checks to 3 and discard diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -index 48b1cddfca671ac8bcb93a1b60518a4ee9e977e2..48a1b0cd306f3c23d7d4049dfa6a2c1be7b5a05f 100644 +index c906ca07509939a06b9aaf2da0dafb172830a638..c1e91ea440202014419aa9601915f9288a41e32c 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java @@ -8,6 +8,7 @@ import com.mojang.datafixers.util.Pair; @@ -18,9 +18,9 @@ index 48b1cddfca671ac8bcb93a1b60518a4ee9e977e2..48a1b0cd306f3c23d7d4049dfa6a2c1b import net.minecraft.BlockUtil; import net.minecraft.Util; @@ -104,6 +105,7 @@ public abstract class AbstractMinecart extends VehicleEntity { - private double flyingX = 0.949999988079071D; // Paper - restore vanilla precision - private double flyingY = 0.949999988079071D; // Paper - restore vanilla precision - private double flyingZ = 0.949999988079071D; // Paper - restore vanilla precision + private double flyingX = 0.95; + private double flyingY = 0.95; + private double flyingZ = 0.95; + private long lastLargeCollision = 0L; // Scissors - Add a collision debounce public double maxSpeed = 0.4D; // CraftBukkit end diff --git a/patches/server/0027-Add-spectator-teleport-event.patch b/patches/server/0027-Add-spectator-teleport-event.patch index b5ebb36..a113755 100644 --- a/patches/server/0027-Add-spectator-teleport-event.patch +++ b/patches/server/0027-Add-spectator-teleport-event.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add spectator teleport event diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 30ccbab1586a656e0ae41d7406525fb02d9e025b..987001ab3a7cdd1c8c37e528077e5d33060ab505 100644 +index 64255f7db85886421d5029766e8a6d1eadb94cff..2a3f4e6bfc6b122bb2102163381de8c78f06f1b5 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1,5 +1,6 @@ @@ -15,7 +15,7 @@ index 30ccbab1586a656e0ae41d7406525fb02d9e025b..987001ab3a7cdd1c8c37e528077e5d33 import com.google.common.collect.Lists; import com.google.common.primitives.Floats; import com.mojang.authlib.GameProfile; -@@ -2033,6 +2034,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2037,6 +2038,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl Entity entity = packet.getEntity(worldserver); if (entity != null) { diff --git a/patches/server/0028-Prevent-invalid-container-events.patch b/patches/server/0028-Prevent-invalid-container-events.patch index 8c2052b..910262c 100644 --- a/patches/server/0028-Prevent-invalid-container-events.patch +++ b/patches/server/0028-Prevent-invalid-container-events.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent invalid container events diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 987001ab3a7cdd1c8c37e528077e5d33060ab505..87d5f576ef8be68256191df7c3bf4f081c2e7370 100644 +index 2a3f4e6bfc6b122bb2102163381de8c78f06f1b5..2ac044f9e4c4c80263a34f9294cb69829bca132e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -29,6 +29,7 @@ import java.util.function.UnaryOperator; @@ -16,7 +16,7 @@ index 987001ab3a7cdd1c8c37e528077e5d33060ab505..87d5f576ef8be68256191df7c3bf4f08 import net.minecraft.ChatFormatting; import net.minecraft.SharedConstants; import net.minecraft.Util; -@@ -2902,6 +2903,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2909,6 +2910,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl return; } diff --git a/patches/server/0030-Validate-block-entity-entity-tag-query-positions.patch b/patches/server/0030-Validate-block-entity-entity-tag-query-positions.patch index 5433a03..ab966c3 100644 --- a/patches/server/0030-Validate-block-entity-entity-tag-query-positions.patch +++ b/patches/server/0030-Validate-block-entity-entity-tag-query-positions.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Validate block entity/entity tag query positions diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 87d5f576ef8be68256191df7c3bf4f081c2e7370..acb4a7ad68a1d6c1ba43eafdd85ab5f824621507 100644 +index 2ac044f9e4c4c80263a34f9294cb69829bca132e..889f142b6f87d4ccf4c1d2ffd379c96fbbfddd44 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1267,7 +1267,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1265,7 +1265,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (this.player.hasPermissions(2)) { Entity entity = this.player.level().getEntity(packet.getEntityId()); @@ -17,7 +17,7 @@ index 87d5f576ef8be68256191df7c3bf4f081c2e7370..acb4a7ad68a1d6c1ba43eafdd85ab5f8 CompoundTag nbttagcompound = entity.saveWithoutId(new CompoundTag()); this.player.connection.send(new ClientboundTagQueryPacket(packet.getTransactionId(), nbttagcompound)); -@@ -1299,7 +1299,10 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1297,7 +1297,10 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQuery packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); diff --git a/patches/server/0034-Add-configuration-option-to-disable-chat-signatures.patch b/patches/server/0034-Add-configuration-option-to-disable-chat-signatures.patch index 3274052..a6cd3fb 100644 --- a/patches/server/0034-Add-configuration-option-to-disable-chat-signatures.patch +++ b/patches/server/0034-Add-configuration-option-to-disable-chat-signatures.patch @@ -62,7 +62,7 @@ index 85a8a687b1568a56e3e646b37ef78b562c1b8a82..68e2edd39dcbcc9199aeaecff9b32809 } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index acb4a7ad68a1d6c1ba43eafdd85ab5f824621507..e2f434d509be8b523de916d15eb625fe85a58749 100644 +index 889f142b6f87d4ccf4c1d2ffd379c96fbbfddd44..4bdd2e731102c7e3a312ad3144537042dce46923 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1,5 +1,6 @@ @@ -72,7 +72,7 @@ index acb4a7ad68a1d6c1ba43eafdd85ab5f824621507..e2f434d509be8b523de916d15eb625fe import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors import com.google.common.collect.Lists; import com.google.common.primitives.Floats; -@@ -2243,7 +2244,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2247,7 +2248,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) { ServerGamePacketListenerImpl.LOGGER.warn("Failed to update secure chat state for {}: '{}'", this.player.getGameProfile().getName(), exception.getComponent().getString()); @@ -81,7 +81,7 @@ index acb4a7ad68a1d6c1ba43eafdd85ab5f824621507..e2f434d509be8b523de916d15eb625fe this.disconnect(exception.getComponent(), exception.kickCause); // Paper - kick event causes } else { this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED)); -@@ -2291,6 +2292,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2295,6 +2296,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl Optional optional = this.lastSeenMessages.applyUpdate(acknowledgment); if (optional.isEmpty()) { @@ -89,7 +89,7 @@ index acb4a7ad68a1d6c1ba43eafdd85ab5f824621507..e2f434d509be8b523de916d15eb625fe ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString()); this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes } -@@ -2486,6 +2488,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2493,6 +2495,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl synchronized (this.lastSeenMessages) { if (!this.lastSeenMessages.applyOffset(packet.offset())) { @@ -97,7 +97,7 @@ index acb4a7ad68a1d6c1ba43eafdd85ab5f824621507..e2f434d509be8b523de916d15eb625fe ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString()); this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes } -@@ -3464,6 +3467,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3471,6 +3474,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleChatSessionUpdate(ServerboundChatSessionUpdatePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); diff --git a/patches/server/0041-Implement-command-block-events.patch b/patches/server/0041-Implement-command-block-events.patch index 920ddd6..9b6e3d3 100644 --- a/patches/server/0041-Implement-command-block-events.patch +++ b/patches/server/0041-Implement-command-block-events.patch @@ -18,7 +18,7 @@ index c99fc118013cb3d4043638e2001a8297e79ddf9c..cdaa81e1f2167b29ec01cc25e51a8400 private final boolean trackOutput; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e2f434d509be8b523de916d15eb625fe85a58749..bfc3ddcdffb0db44da5e23e3986402d66d5a3d70 100644 +index 4bdd2e731102c7e3a312ad3144537042dce46923..1f7dc235f8cf848d740ef6a8cf879d253b56c1c8 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1,6 +1,8 @@ @@ -47,7 +47,7 @@ index e2f434d509be8b523de916d15eb625fe85a58749..bfc3ddcdffb0db44da5e23e3986402d6 import org.slf4j.Logger; // CraftBukkit start -@@ -896,6 +901,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -894,6 +899,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.level().getChunkAt(blockposition).setBlockEntity(tileentity); } @@ -64,7 +64,7 @@ index e2f434d509be8b523de916d15eb625fe85a58749..bfc3ddcdffb0db44da5e23e3986402d6 commandblocklistenerabstract.setCommand(s); commandblocklistenerabstract.setTrackOutput(flag); if (!flag) { -@@ -927,7 +942,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -925,7 +940,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level()); if (commandblocklistenerabstract != null) { diff --git a/patches/server/0046-Fix-packet-related-lag-exploits.patch b/patches/server/0046-Fix-packet-related-lag-exploits.patch index 5cbb473..ad22369 100644 --- a/patches/server/0046-Fix-packet-related-lag-exploits.patch +++ b/patches/server/0046-Fix-packet-related-lag-exploits.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix packet-related lag exploits diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index bfc3ddcdffb0db44da5e23e3986402d66d5a3d70..38ab3f9fe6bcad429d6431b59bc3ffb3c3cc5eb6 100644 +index 1f7dc235f8cf848d740ef6a8cf879d253b56c1c8..2ef6fd0fadaf6b912c4f242210c1ce2756ccddd7 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -861,7 +861,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -859,7 +859,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.sendSystemMessage(Component.translatable("advMode.notEnabled")); } else if (!this.player.canUseGameMasterBlocks() && (!this.player.isCreative() || !this.player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission this.player.sendSystemMessage(Component.translatable("advMode.notAllowed")); @@ -17,7 +17,7 @@ index bfc3ddcdffb0db44da5e23e3986402d66d5a3d70..38ab3f9fe6bcad429d6431b59bc3ffb3 BaseCommandBlock commandblocklistenerabstract = null; CommandBlockEntity tileentitycommand = null; BlockPos blockposition = packet.getPos(); -@@ -1028,7 +1028,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1026,7 +1026,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleSetStructureBlock(ServerboundSetStructureBlockPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); @@ -26,7 +26,7 @@ index bfc3ddcdffb0db44da5e23e3986402d66d5a3d70..38ab3f9fe6bcad429d6431b59bc3ffb3 BlockPos blockposition = packet.getPos(); BlockState iblockdata = this.player.level().getBlockState(blockposition); BlockEntity tileentity = this.player.level().getBlockEntity(blockposition); -@@ -1086,7 +1086,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1084,7 +1084,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleSetJigsawBlock(ServerboundSetJigsawBlockPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); @@ -35,7 +35,7 @@ index bfc3ddcdffb0db44da5e23e3986402d66d5a3d70..38ab3f9fe6bcad429d6431b59bc3ffb3 BlockPos blockposition = packet.getPos(); BlockState iblockdata = this.player.level().getBlockState(blockposition); BlockEntity tileentity = this.player.level().getBlockEntity(blockposition); -@@ -1111,7 +1111,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1109,7 +1109,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleJigsawGenerate(ServerboundJigsawGeneratePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());