diff --git a/build.gradle.kts b/build.gradle.kts index eb5c674d2..e69ad97f6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -51,7 +51,6 @@ subprojects { maven("https://hub.spigotmc.org/nexus/content/groups/public/") maven("https://jitpack.io") maven("https://repo.codemc.io/repository/maven-public/") - maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") // TODO - Adventure snapshot } } diff --git a/gradle.properties b/gradle.properties index 84333deff..a81aff492 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ group = cn.dreeam.leaf version = 1.20.6-R0.1-SNAPSHOT -galeCommit = 0e950b05e9b6c44bcb0b8f6e7073a40562b03733 +galeCommit = 7bede3340526bc44ba04a743e11529feaea9aa45 org.gradle.caching = true org.gradle.parallel = true diff --git a/patches/api/0003-Purpur-API-Changes.patch b/patches/api/0003-Purpur-API-Changes.patch index d9c651ac1..9d64828ab 100644 --- a/patches/api/0003-Purpur-API-Changes.patch +++ b/patches/api/0003-Purpur-API-Changes.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Purpur API Changes Original license: MIT Original project: https://github.com/PurpurMC/Purpur -Commit: e1a0fc3b6a3cde39edd367884480df9a583b63b7 +Commit: 8aa793450315a361548f5e1dce4edf18e606bf51 Patches below are removed in this patch: Pufferfish-API-Changes.patch diff --git a/patches/api/0005-Bump-Dependencies.patch b/patches/api/0005-Bump-Dependencies.patch index e165bd45e..2ee0b45dd 100644 --- a/patches/api/0005-Bump-Dependencies.patch +++ b/patches/api/0005-Bump-Dependencies.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Bump Dependencies diff --git a/build.gradle.kts b/build.gradle.kts -index a085f6fa2cfb3721752b38096a2c35fcdd114d02..b3410e3fcead1deec4c052bf813a243f55b3b0cd 100644 +index 03ea85ce7d8724518ae0e07dcc6495e99f38f67c..01fd7ac998aef82923efc54c3341e46b2f19235c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,8 +12,10 @@ java { val annotationsVersion = "24.1.0" val bungeeCordChatVersion = "1.20-R0.2" - val adventureVersion = "4.17.0-SNAPSHOT" + val adventureVersion = "4.17.0" -val slf4jVersion = "2.0.9" -val log4jVersion = "2.17.1" +// Leaf start - Bump Dependencies @@ -94,8 +94,8 @@ index a085f6fa2cfb3721752b38096a2c35fcdd114d02..b3410e3fcead1deec4c052bf813a243f // Paper end // Paper start @@ -159,9 +165,9 @@ tasks.withType { - //"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/", - //"https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/", + "https://jd.advntr.dev/text-serializer-plain/$adventureVersion/", + "https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/", "https://javadoc.io/doc/org.slf4j/slf4j-api/$slf4jVersion/", - "https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/$log4jVersion/", + "https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/2.20.0", // Leaf - Bump Dependencies diff --git a/patches/generated-api/0001-Purpur-generated-api-Changes.patch b/patches/generated-api/0001-Purpur-generated-api-Changes.patch index bb9ad9f0d..48fd39ae6 100644 --- a/patches/generated-api/0001-Purpur-generated-api-Changes.patch +++ b/patches/generated-api/0001-Purpur-generated-api-Changes.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Purpur generated-api Changes Original license: MIT Original project: https://github.com/PurpurMC/Purpur -Commit: e1a0fc3b6a3cde39edd367884480df9a583b63b7 +Commit: 8aa793450315a361548f5e1dce4edf18e606bf51 diff --git a/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/com/destroystokyo/paper/entity/ai/VanillaGoal.java index 43f4deacef349502cbb207aafc4f9cb7a75177c5..6b692c24a62e2172116a6b9c371b1c0e2411c27e 100644 diff --git a/patches/server/0010-Purpur-Server-Changes.patch b/patches/server/0010-Purpur-Server-Changes.patch index ece224ee6..b12c3b61b 100644 --- a/patches/server/0010-Purpur-Server-Changes.patch +++ b/patches/server/0010-Purpur-Server-Changes.patch @@ -9,7 +9,7 @@ Fix-pufferfish-issues.patch Original license: MIT Original project: https://github.com/PurpurMC/Purpur -Commit: e1a0fc3b6a3cde39edd367884480df9a583b63b7 +Commit: 8aa793450315a361548f5e1dce4edf18e606bf51 Patches below are removed in this patch: Metrics changes in Purpur-config-files.patch @@ -32,7 +32,7 @@ Remove-Mojang-Profiler.patch MC-121706-Fix-mobs-not-looking-up-and-down-when-stra.patch diff --git a/build.gradle.kts b/build.gradle.kts -index 663d5bfd7c541a193a1636e6f6f8ae5b656b080b..2e0bb52941718f4ae2600e293bbe4126d0889f40 100644 +index f9dc6deb2e5e94bfd4aff747699a90423c4391a1..aa9098d9a86ccac64777aeba875d724a6691c588 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -63,6 +63,12 @@ dependencies { @@ -712,7 +712,7 @@ index bbeb88843f210abdf1cafed11394380cfcab0e09..e68ecaf8d60517fe6398338702a7a796 Bootstrap.bootStrap(); Bootstrap.validate(); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index fffe9e1c307e83b0dcb6c40bf0820f9f9f5c4528..0b4f7dcb082e758cfdce646c61175a48c0c1f5ec 100644 +index fffe9e1c307e83b0dcb6c40bf0820f9f9f5c4528..05725e2aed4ad03685bdadbf3bb898da3e62c1b7 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -285,6 +285,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper - Add EntityMoveEvent net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers worldserver.updateLagCompensationTick(); // Paper - lag compensation @@ -13748,15 +13765,12 @@ index eb74d45ad458b80cf8455297c3bc550186adaea3..ef01856c487e4ab982996e0153761823 return InteractionResultHolder.fail(itemstack); } else { diff --git a/src/main/java/net/minecraft/world/item/BowItem.java b/src/main/java/net/minecraft/world/item/BowItem.java -index 5ca843df5b4caa668953e5e36a9b20fabeb35046..ff39d3614f360918d74b54b817bc227f89d34c9c 100644 +index 5ca843df5b4caa668953e5e36a9b20fabeb35046..8bca38ec152f9612298bf6b3e10e7e0566ec3b78 100644 --- a/src/main/java/net/minecraft/world/item/BowItem.java +++ b/src/main/java/net/minecraft/world/item/BowItem.java -@@ -29,9 +29,9 @@ public class BowItem extends ProjectileWeaponItem { - int i = this.getUseDuration(stack) - remainingUseTicks; - float f = getPowerForTime(i); +@@ -31,7 +31,7 @@ public class BowItem extends ProjectileWeaponItem { if (!((double)f < 0.1)) { -- List list = draw(stack, itemStack, player); -+ List list = draw(stack, itemStack, player, !((itemStack.is(Items.ARROW) && world.purpurConfig.infinityWorksWithNormalArrows) || (itemStack.is(Items.TIPPED_ARROW) && world.purpurConfig.infinityWorksWithTippedArrows) || (itemStack.is(Items.SPECTRAL_ARROW) && world.purpurConfig.infinityWorksWithSpectralArrows))); + List list = draw(stack, itemStack, player); if (!world.isClientSide() && !list.isEmpty()) { - this.shoot(world, player, player.getUsedItemHand(), stack, list, f * 3.0F, 1.0F, f == 1.0F, null); + this.shoot(world, player, player.getUsedItemHand(), stack, list, f * 3.0F, (float) world.purpurConfig.bowProjectileOffset, f == 1.0F, null); // Purpur @@ -13768,7 +13782,7 @@ index 5ca843df5b4caa668953e5e36a9b20fabeb35046..ff39d3614f360918d74b54b817bc227f ItemStack itemStack = user.getItemInHand(hand); boolean bl = !user.getProjectile(itemStack).isEmpty(); - if (!user.hasInfiniteMaterials() && !bl) { -+ if (!(world.purpurConfig.infinityWorksWithoutArrows && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.INFINITY, itemStack) > 0) && !user.hasInfiniteMaterials() && !bl) { ++ if (!(world.purpurConfig.infinityWorksWithoutArrows && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.INFINITY, itemStack) > 0) && !user.hasInfiniteMaterials() && !bl) { // Purpur return InteractionResultHolder.fail(itemStack); } else { user.startUsingItem(hand); @@ -14119,10 +14133,10 @@ index 774c982f28b4f127fc3f036c19dfb47fb9ae3264..d49b60e7e643498b49c03593dc0da2f8 // Paper end - Add PlayerNameEntityEvent mob.setPersistenceRequired(); diff --git a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java -index d27e83c08c45b8514207f26e48ceb1a91ded94be..8f01772a7b06b2acf96a3f922cb9b481f634680b 100644 +index d27e83c08c45b8514207f26e48ceb1a91ded94be..4f352c48007107e1306147310eec53ae17b2d9f0 100644 --- a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java +++ b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java -@@ -131,6 +131,14 @@ public abstract class ProjectileWeaponItem extends Item { +@@ -131,11 +131,26 @@ public abstract class ProjectileWeaponItem extends Item { entityarrow.setPierceLevel((byte) k); } @@ -14137,6 +14151,28 @@ index d27e83c08c45b8514207f26e48ceb1a91ded94be..8f01772a7b06b2acf96a3f922cb9b481 return entityarrow; } + protected static boolean hasInfiniteArrows(ItemStack weaponStack, ItemStack projectileStack, boolean creative) { +- return creative || projectileStack.is(Items.ARROW) && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.INFINITY, weaponStack) > 0; ++ // Purpur start ++ return hasInfiniteArrows(weaponStack, projectileStack, creative, null); ++ } ++ ++ protected static boolean hasInfiniteArrows(ItemStack weaponStack, ItemStack projectileStack, boolean creative, @javax.annotation.Nullable Level level) { ++ boolean canBeInfinity = level == null ? projectileStack.is(Items.ARROW) : ((projectileStack.is(Items.ARROW) && level.purpurConfig.infinityWorksWithNormalArrows) || (projectileStack.is(Items.TIPPED_ARROW) && level.purpurConfig.infinityWorksWithTippedArrows) || (projectileStack.is(Items.SPECTRAL_ARROW) && level.purpurConfig.infinityWorksWithSpectralArrows)); ++ return creative || canBeInfinity && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.INFINITY, weaponStack) > 0; ++ // Purpur end + } + + protected static List draw(ItemStack weaponStack, ItemStack projectileStack, LivingEntity shooter) { +@@ -161,7 +176,7 @@ public abstract class ProjectileWeaponItem extends Item { + } + + protected static ItemStack useAmmo(ItemStack weaponStack, ItemStack projectileStack, LivingEntity shooter, boolean multishot) { +- boolean flag1 = !multishot && !ProjectileWeaponItem.hasInfiniteArrows(weaponStack, projectileStack, shooter.hasInfiniteMaterials()); ++ boolean flag1 = !multishot && !ProjectileWeaponItem.hasInfiniteArrows(weaponStack, projectileStack, shooter.hasInfiniteMaterials(), shooter.level()); // Purpur + ItemStack itemstack2; + + if (!flag1) { diff --git a/src/main/java/net/minecraft/world/item/ShovelItem.java b/src/main/java/net/minecraft/world/item/ShovelItem.java index 24f6a158e4759aac3be8da4cf5e0d40bd295355b..6b7dbb570f8a698c87c6bce992d84d87b55176e6 100644 --- a/src/main/java/net/minecraft/world/item/ShovelItem.java @@ -17870,10 +17906,10 @@ index 52649f82351ab4f675c3cc3cd6640956b0f76b91..eb51c88c7a0658190d3a8bfd5d18dca7 DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "seed", "Allows the user to view the seed of the world", PermissionDefault.OP, commands); diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java new file mode 100644 -index 0000000000000000000000000000000000000000..8facd29bac314d4b8897113460f78ea7ed3e82b6 +index 0000000000000000000000000000000000000000..eaa8b63b0fb1f0ebefba9014cfec7f1065332171 --- /dev/null +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -@@ -0,0 +1,570 @@ +@@ -0,0 +1,582 @@ +package org.purpurmc.purpur; + +import com.google.common.base.Throwables; @@ -18023,7 +18059,7 @@ index 0000000000000000000000000000000000000000..8facd29bac314d4b8897113460f78ea7 + return config.getInt(path, config.getInt(path)); + } + -+ private static List getList(String path, T def) { ++ private static List getList(String path, T def) { + config.addDefault(path, def); + return config.getList(path, config.getList(path)); + } @@ -18443,6 +18479,18 @@ index 0000000000000000000000000000000000000000..8facd29bac314d4b8897113460f78ea7 + private static void registerMinecraftDebugCommands() { + registerMinecraftDebugCommands = getBoolean("settings.register-minecraft-debug-commands", registerMinecraftDebugCommands); + } ++ ++ public static List startupCommands = new ArrayList<>(); ++ private static void startupCommands() { ++ startupCommands.clear(); ++ getList("settings.startup-commands", new ArrayList()).forEach(line -> { ++ String command = line.toString(); ++ if (command.startsWith("/")) { ++ command = command.substring(1); ++ } ++ startupCommands.add(command); ++ }); ++ } +} diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java new file mode 100644 diff --git a/patches/server/0011-Fix-Pufferfish-and-Purpur-patches.patch b/patches/server/0011-Fix-Pufferfish-and-Purpur-patches.patch index d7db7ee31..f4a8ee6ff 100644 --- a/patches/server/0011-Fix-Pufferfish-and-Purpur-patches.patch +++ b/patches/server/0011-Fix-Pufferfish-and-Purpur-patches.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix Pufferfish and Purpur patches diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0b4f7dcb082e758cfdce646c61175a48c0c1f5ec..dea8fef7abe8cfb7dabd8ae4aad748134f7bd47f 100644 +index 05725e2aed4ad03685bdadbf3bb898da3e62c1b7..367180dee333b071cfed805356b1def5201efaa9 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -296,7 +296,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { return !this.canSleepForTickNoOversleep(); // Paper - move oversleep into full server tick -@@ -1471,8 +1467,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { entityplayer.connection.suspendFlushing(); }); @@ -1031,7 +1031,7 @@ index 20ec096a3a466f3b97e1723ffc5cc96848ce23e3..10e3eb23c00b2af646f198f789129814 // Paper start - Folia scheduler API ((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick(); getAllLevels().forEach(level -> { -@@ -1727,20 +1710,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop