diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch index 14c979390c..0900252089 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/Adventure.patch @@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 api("com.google.code.gson:gson:2.10") - api("net.md-5:bungeecord-chat:1.16-R0.4") + api("net.md-5:bungeecord-chat:1.16-R0.4-deprecated+build.9") // Paper - api("org.yaml:snakeyaml:1.33") + api("org.yaml:snakeyaml:2.0") api("org.joml:joml:1.10.5") // Paper start @@ -0,0 +0,0 @@ dependencies { @@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 compileOnly("org.apache.maven:maven-resolver-provider:3.9.2") @@ -0,0 +0,0 @@ tasks.withType { "https://guava.dev/releases/31.1-jre/api/docs/", - "https://javadoc.io/doc/org.yaml/snakeyaml/1.33/", + "https://javadoc.io/doc/org.yaml/snakeyaml/2.0/", "https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/", // Paper - we don't want Java 5 annotations - "https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/", + // Paper start diff --git a/patches/api/Build-system-changes.patch b/patches/api/Build-system-changes.patch index 4b13d42510..5dd813b8af 100644 --- a/patches/api/Build-system-changes.patch +++ b/patches/api/Build-system-changes.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/build.gradle.kts @@ -0,0 +0,0 @@ dependencies { api("net.md-5:bungeecord-chat:1.16-R0.4") - api("org.yaml:snakeyaml:1.33") + api("org.yaml:snakeyaml:2.0") api("org.joml:joml:1.10.5") + // Paper start + api("com.googlecode.json-simple:json-simple:1.1.1") { @@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ tasks.withType { options.links( "https://guava.dev/releases/31.1-jre/api/docs/", - "https://javadoc.io/doc/org.yaml/snakeyaml/1.33/", + "https://javadoc.io/doc/org.yaml/snakeyaml/2.0/", - "https://javadoc.io/doc/org.jetbrains/annotations-java5/$annotationsVersion/", + "https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/", // Paper - we don't want Java 5 annotations "https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/", diff --git a/patches/api/Convert-project-to-Gradle.patch b/patches/api/Convert-project-to-Gradle.patch index 44017ae3ec..cffc98f39d 100644 --- a/patches/api/Convert-project-to-Gradle.patch +++ b/patches/api/Convert-project-to-Gradle.patch @@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + api("com.google.guava:guava:31.1-jre") + api("com.google.code.gson:gson:2.10") + api("net.md-5:bungeecord-chat:1.16-R0.4") -+ api("org.yaml:snakeyaml:1.33") ++ api("org.yaml:snakeyaml:2.0") + api("org.joml:joml:1.10.5") + + compileOnly("org.apache.maven:maven-resolver-provider:3.9.2") @@ -62,7 +62,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + testImplementation("org.apache.commons:commons-lang3:3.12.0") + testImplementation("junit:junit:4.13.2") + testImplementation("org.hamcrest:hamcrest-library:1.3") -+ testImplementation("org.ow2.asm:asm-tree:9.4") ++ testImplementation("org.ow2.asm:asm-tree:9.5") +} + +configure { @@ -99,7 +99,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + options.isDocFilesSubDirs = true + options.links( + "https://guava.dev/releases/31.1-jre/api/docs/", -+ "https://javadoc.io/doc/org.yaml/snakeyaml/1.33/", ++ "https://javadoc.io/doc/org.yaml/snakeyaml/2.0/", + "https://javadoc.io/doc/org.jetbrains/annotations-java5/$annotationsVersion/", + "https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/", + ) @@ -318,7 +318,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - - - https://guava.dev/releases/31.1-jre/api/docs/ -- https://javadoc.io/doc/org.yaml/snakeyaml/1.33/ +- https://javadoc.io/doc/org.yaml/snakeyaml/2.0/ - https://javadoc.io/doc/org.jetbrains/annotations-java5/24.0.1/ - https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/ - diff --git a/patches/server/Add-openSign-method-to-HumanEntity.patch b/patches/server/Add-openSign-method-to-HumanEntity.patch index 648852211d..915979d7f0 100644 --- a/patches/server/Add-openSign-method-to-HumanEntity.patch +++ b/patches/server/Add-openSign-method-to-HumanEntity.patch @@ -12,17 +12,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 super.applyTo(sign); } -- public static void openSign(Sign sign, Player player) { -+ public static void openSign(Sign sign, org.bukkit.entity.HumanEntity player) { // Paper - change move open sign to HumanEntity +- public static void openSign(Sign sign, Player player, Side side) { ++ public static void openSign(Sign sign, org.bukkit.entity.HumanEntity player, Side side) { // Paper - change move open sign to HumanEntity Preconditions.checkArgument(sign != null, "sign == null"); + Preconditions.checkArgument(side != null, "side == null"); - Preconditions.checkArgument(sign.isPlaced(), "Sign must be placed"); + // Preconditions.checkArgument(sign.isPlaced(), "Sign must be placed"); // Paper - don't require placed Preconditions.checkArgument(sign.getWorld() == player.getWorld(), "Sign must be in same world as Player"); SignBlockEntity handle = ((CraftSign) sign).getTileEntity(); -- ((CraftPlayer) player).getHandle().openTextEdit(handle, true); -+ ((org.bukkit.craftbukkit.entity.CraftHumanEntity) player).getHandle().openTextEdit(handle, true); // Paper - change move open sign to HumanEntity +- ((CraftPlayer) player).getHandle().openTextEdit(handle, Side.FRONT == side); ++ ((org.bukkit.craftbukkit.entity.CraftHumanEntity) player).getHandle().openTextEdit(handle, Side.FRONT == side); // Paper - change move open sign to HumanEntity } // Paper start diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index 8764a44060..b63a7e9b2a 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -2798,32 +2798,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java @@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C - // CraftBukkit start - Player player1 = ((ServerPlayer) player).getBukkitEntity(); -- String[] lines = new String[4]; -+ // Paper start -+ List lines = new java.util.ArrayList<>(); + // CraftBukkit start + Player player = ((ServerPlayer) entityhuman).getBukkitEntity(); +- String[] lines = new String[4]; ++ List lines = new java.util.ArrayList<>(); // Paper - adventure - for (int j = 0; j < messages.size(); ++j) { -- lines[j] = CraftChatMessage.fromComponent(text.getMessage(j, player.isTextFilteringEnabled())); -+ lines.add(io.papermc.paper.adventure.PaperAdventure.asAdventure(text.getMessage(j, player.isTextFilteringEnabled()))); - } - - SignChangeEvent event = new SignChangeEvent(CraftBlock.at(this.level, this.worldPosition), player1, lines); - player.level().getCraftServer().getPluginManager().callEvent(event); - - if (!event.isCancelled()) { -- Component[] components = org.bukkit.craftbukkit.block.CraftSign.sanitizeLines(event.getLines()); -- for (int j = 0; j < components.length; j++) { -- text = text.setMessage(j, components[j]); -+ // Paper start -+ for (int j = 0; j < 4; j++) { -+ text = text.setMessage(j, io.papermc.paper.adventure.PaperAdventure.asVanilla(lines.get(j))); - } -+ // Paper end - } - // CraftBukkit end + for (int j = 0; j < list.size(); ++j) { +- lines[j] = CraftChatMessage.fromComponent(signtext.getMessage(j, entityhuman.isTextFilteringEnabled())); ++ lines.add(io.papermc.paper.adventure.PaperAdventure.asAdventure(signtext.getMessage(j, entityhuman.isTextFilteringEnabled()))); // Paper - adventure } + + SignChangeEvent event = new SignChangeEvent(CraftBlock.at(this.level, this.worldPosition), player, lines, (front) ? Side.FRONT : Side.BACK); + entityhuman.level().getCraftServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { +- Component[] components = org.bukkit.craftbukkit.block.CraftSign.sanitizeLines(event.getLines()); +- for (int j = 0; j < components.length; j++) { +- signtext = signtext.setMessage(j, components[j]); ++ // Paper start - adventure ++ for (int j = 0; j < 4; j++) { ++ signtext = signtext.setMessage(j, io.papermc.paper.adventure.PaperAdventure.asVanilla(lines.get(j))); ++ // Paper end - adventure + } + } else { + signtext = originalText; diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java @@ -3235,7 +3233,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public String[] getLines() { return this.front.getLines(); @@ -0,0 +0,0 @@ public class CraftSign extends CraftBlockEntityState< - ((CraftPlayer) player).getHandle().openTextEdit(handle, true); + ((CraftPlayer) player).getHandle().openTextEdit(handle, Side.FRONT == side); } + // Paper start @@ -3269,7 +3267,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private java.util.ArrayList originalLines = null; // ArrayList for RandomAccess + private java.util.ArrayList lines = null; // ArrayList for RandomAccess + // Paper end - private final SignText signText; + private SignText signText; public CraftSignSide(SignText signText) { this.signText = signText; @@ -3344,7 +3342,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override @@ -0,0 +0,0 @@ public class CraftSignSide implements SignSide { - public void applyLegacyStringToSignSide() { + public SignText applyLegacyStringToSignSide() { if (this.lines != null) { - for (int i = 0; i < lines.length; i++) { - String line = (this.lines[i] == null) ? "" : this.lines[i]; @@ -3356,13 +3354,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (component.equals(origComp)) { continue; // The line contents are still the same, skip. } -- this.signText.setMessage(i, CraftChatMessage.fromString(line)[0]); -+ this.signText.setMessage(i, io.papermc.paper.adventure.PaperAdventure.asVanilla(component)); +- this.signText = this.signText.setMessage(i, CraftChatMessage.fromString(line)[0]); ++ this.signText = this.signText.setMessage(i, io.papermc.paper.adventure.PaperAdventure.asVanilla(component)); } + // Paper end } - } - } + + return this.signText; diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java diff --git a/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index 182d02e7e7..2dd69fe13a 100644 --- a/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -149,11 +149,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/animal/Animal.java +++ b/src/main/java/net/minecraft/world/entity/animal/Animal.java @@ -0,0 +0,0 @@ public abstract class Animal extends AgeableMob { - if (world.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { + if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // CraftBukkit start - use event experience if (experience > 0) { -- world.addFreshEntity(new ExperienceOrb(world, this.getX(), this.getY(), this.getZ(), experience)); -+ world.addFreshEntity(new ExperienceOrb(world, this.getX(), this.getY(), this.getZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, null)); // Paper //TODO trigger +- worldserver.addFreshEntity(new ExperienceOrb(worldserver, this.getX(), this.getY(), this.getZ(), experience)); ++ worldserver.addFreshEntity(new ExperienceOrb(worldserver, this.getX(), this.getY(), this.getZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, null)); // Paper //TODO trigger } // CraftBukkit end } diff --git a/patches/server/Fix-NPE-for-BlockDataMeta-getBlockData.patch b/patches/server/Fix-NPE-for-BlockDataMeta-getBlockData.patch deleted file mode 100644 index a7c99713f7..0000000000 --- a/patches/server/Fix-NPE-for-BlockDataMeta-getBlockData.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 27 Mar 2022 16:00:28 -0700 -Subject: [PATCH] Fix NPE for BlockDataMeta#getBlockData - - -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { - - @Override - public BlockData getBlockData(Material material) { -- return CraftBlockData.fromData(BlockItem.getBlockState(CraftMagicNumbers.getBlock(material).defaultBlockState(), blockData)); -+ // Paper start - fix NPE if this.blockData is null -+ final net.minecraft.world.level.block.state.BlockState defaultBlockState = CraftMagicNumbers.getBlock(material).defaultBlockState(); -+ return CraftBlockData.fromData(this.blockData == null ? defaultBlockState : BlockItem.getBlockState(defaultBlockState, blockData)); -+ // Paper end - } - - @Override diff --git a/patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch b/patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch index c71073d261..eeccf72da7 100644 --- a/patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch +++ b/patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch @@ -4,19 +4,32 @@ Date: Thu, 26 Apr 2018 04:41:11 -0400 Subject: [PATCH] Fix exploit that allowed colored signs to be created +diff --git a/build.gradle.kts b/build.gradle.kts +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -0,0 +0,0 @@ dependencies { + implementation("io.netty:netty-all:4.1.87.Final"); // Paper - Bump netty + } + +-val craftbukkitPackageVersion = "1_19_R3" // Paper ++val craftbukkitPackageVersion = "1_20_R1" // Paper + tasks.jar { + archiveClassifier.set("dev") + diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java @@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C - Style chatmodifier = text.getMessage(i, player.isTextFilteringEnabled()).getStyle(); + Style chatmodifier = signtext.getMessage(i, entityhuman.isTextFilteringEnabled()).getStyle(); - if (player.isTextFilteringEnabled()) { -- text = text.setMessage(i, Component.literal(filteredtext.filteredOrEmpty()).setStyle(chatmodifier)); -+ text = text.setMessage(i, Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.filteredOrEmpty())).setStyle(chatmodifier)); // Paper - filter sign text to chat only + if (entityhuman.isTextFilteringEnabled()) { +- signtext = signtext.setMessage(i, Component.literal(filteredtext.filteredOrEmpty()).setStyle(chatmodifier)); ++ signtext = signtext.setMessage(i, Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.filteredOrEmpty())).setStyle(chatmodifier)); // Paper - filter sign text to chat only } else { -- text = text.setMessage(i, Component.literal(filteredtext.raw()).setStyle(chatmodifier), Component.literal(filteredtext.filteredOrEmpty()).setStyle(chatmodifier)); -+ text = text.setMessage(i, Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.raw())).setStyle(chatmodifier), Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.filteredOrEmpty())).setStyle(chatmodifier)); // Paper - filter sign text to chat only +- signtext = signtext.setMessage(i, Component.literal(filteredtext.raw()).setStyle(chatmodifier), Component.literal(filteredtext.filteredOrEmpty()).setStyle(chatmodifier)); ++ signtext = signtext.setMessage(i, Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.raw())).setStyle(chatmodifier), Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.filteredOrEmpty())).setStyle(chatmodifier)); // Paper - filter sign text to chat only } + } - // CraftBukkit start diff --git a/patches/server/Setup-Gradle-project.patch b/patches/server/Setup-Gradle-project.patch index fc33d0f8d8..49d7c64d33 100644 --- a/patches/server/Setup-Gradle-project.patch +++ b/patches/server/Setup-Gradle-project.patch @@ -578,7 +578,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - - net.md-5 - specialsource-maven-plugin -- 1.2.5 +- 1.2.4 - - - package diff --git a/work/Bukkit b/work/Bukkit index 3635fe1a77..2d009e6420 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 3635fe1a771a768acc67a9ab8b3ea184fc724bae +Subproject commit 2d009e6420462f8de68db42906fe1f4f4931c3fd diff --git a/work/CraftBukkit b/work/CraftBukkit index e1188ed3a2..f3b2b22103 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit e1188ed3a2f295cba417e59645ca22c97b4587a4 +Subproject commit f3b2b2210362d2f322fe1999e96453bc4abb98a4 diff --git a/work/Spigot b/work/Spigot index 81b9def3c8..723951c3cf 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 81b9def3c89c26289118ed0e43ec4df167edd56c +Subproject commit 723951c3cf8cf3bb6721b3da29cd262f642fbfb1