From 106b1bf7fd225d7d9280e6e89432c40ca14bfbcf Mon Sep 17 00:00:00 2001 From: Lumine1909 <133463833+Lumine1909@users.noreply.github.com> Date: Tue, 22 Apr 2025 11:20:36 -0400 Subject: [PATCH] Start 1.21.5 (#468) * 1.21.5 start & API fixing done * Start server, -1/120, -1/16 --- gradle.properties | 6 +- leaves-api/build.gradle.kts.patch | 11 +- .../features/0001-Delete-Timings.patch | 67 ++++---- ...Add-isShrink-to-EntityResurrectEvent.patch | 44 ++--- .../features/0003-Add-fakeplayer-api.patch | 8 +- .../0004-Force-peaceful-mode-switch.patch | 4 +- .../features/0005-Replay-Mod-API.patch | 8 +- .../features/0006-Bytebuf-API.patch | 12 +- .../features/0007-Revert-raid-changes.patch | 4 +- .../0008-Fix-SculkCatalyst-exp-skip.patch | 40 +++-- leaves-server/build.gradle.kts.patch | 55 ++++-- leaves-server/build.gradle.kts.patch.bak | 156 ++++++++++++++++++ 12 files changed, 307 insertions(+), 108 deletions(-) create mode 100644 leaves-server/build.gradle.kts.patch.bak diff --git a/gradle.properties b/gradle.properties index 5fbbc59f..b7e1d260 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ group=org.leavesmc.leaves -version=1.21.4-R0.1-SNAPSHOT -mcVersion=1.21.4 -paperRef=9b1798d6438107fdf0d5939b79a8cf71f4d16e2c +version=1.21.5-R0.1-SNAPSHOT +mcVersion=1.21.5 +paperRef=5f0b82925e06c90400b4069631b15c8f2c47c76d preVersion=false org.gradle.caching=true org.gradle.parallel=true diff --git a/leaves-api/build.gradle.kts.patch b/leaves-api/build.gradle.kts.patch index 48fd6832..f3e00c95 100644 --- a/leaves-api/build.gradle.kts.patch +++ b/leaves-api/build.gradle.kts.patch @@ -1,21 +1,22 @@ --- a/paper-api/build.gradle.kts +++ b/paper-api/build.gradle.kts -@@ -93,19 +_,33 @@ +@@ -93,19 +_,34 @@ testRuntimeOnly("org.junit.platform:junit-platform-launcher") } --val generatedApiPath: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath() -+val generatedApiPath: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath() // Leaves - build change +-val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath() ++val generatedDir: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath() // Leaves - build change idea { module { - generatedSourceDirs.add(generatedApiPath.toFile()) + generatedSourceDirs.add(generatedDir.toFile()) ++ } } +// Leaves start - build change sourceSets { main { java { - srcDir(generatedApiPath) + srcDir(generatedDir) + srcDir(file("../paper-api/src/main/java")) + } + resources { diff --git a/leaves-api/paper-patches/features/0001-Delete-Timings.patch b/leaves-api/paper-patches/features/0001-Delete-Timings.patch index 0c42184f..cf282548 100644 --- a/leaves-api/paper-patches/features/0001-Delete-Timings.patch +++ b/leaves-api/paper-patches/features/0001-Delete-Timings.patch @@ -730,7 +730,7 @@ index 199789d56d22fcb1b77ebd56805cc28aa5a5ab0a..00000000000000000000000000000000 -} diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java deleted file mode 100644 -index 6f6eb1a2e6c8d49014a7ae44540ee282bae5200e..0000000000000000000000000000000000000000 +index c8287776ad585d04fb4fa3290cd73d7097035ea0..0000000000000000000000000000000000000000 --- a/src/main/java/co/aikar/timings/TimingHistory.java +++ /dev/null @@ -1,357 +0,0 @@ @@ -1025,7 +1025,7 @@ index 6f6eb1a2e6c8d49014a7ae44540ee282bae5200e..00000000000000000000000000000000 - final TicksRecord ticksRecord = new TicksRecord(); - final PingRecord pingRecord = new PingRecord(); - final TimingData fst = TimingsManager.FULL_SERVER_TICK.minuteData.clone(); -- final double tps = 1E9 / ( System.nanoTime() - lastMinuteTime ) * ticksRecord.timed; +- final double tps = 1E9 / (System.nanoTime() - lastMinuteTime) * ticksRecord.timed; - final double usedMemory = TimingsManager.FULL_SERVER_TICK.avgUsedMemory; - final double freeMemory = TimingsManager.FULL_SERVER_TICK.avgFreeMemory; - final double loadAvg = ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage(); @@ -1743,7 +1743,7 @@ index b83e5ff7ada8771fdf27ba9807c77ba6a4ce12da..00000000000000000000000000000000 -} diff --git a/src/main/java/co/aikar/timings/TimingsManager.java b/src/main/java/co/aikar/timings/TimingsManager.java deleted file mode 100644 -index e72ad05abada04426e32a73d02b21cb69079d268..0000000000000000000000000000000000000000 +index 83a70358e9b7d3d9ae76cf130915b3c33d09a793..0000000000000000000000000000000000000000 --- a/src/main/java/co/aikar/timings/TimingsManager.java +++ /dev/null @@ -1,192 +0,0 @@ @@ -1902,9 +1902,9 @@ index e72ad05abada04426e32a73d02b21cb69079d268..00000000000000000000000000000000 - public static Timing getCommandTiming(@Nullable String pluginName, @NotNull Command command) { - Plugin plugin = null; - final Server server = Bukkit.getServer(); -- if (!( server == null || pluginName == null || -- "minecraft".equals(pluginName) || "bukkit".equals(pluginName) || -- "spigot".equalsIgnoreCase(pluginName) || "paper".equals(pluginName) +- if (!(server == null || pluginName == null || +- "minecraft".equals(pluginName) || "bukkit".equals(pluginName) || +- "spigot".equalsIgnoreCase(pluginName) || "paper".equals(pluginName) - )) { - plugin = server.getPluginManager().getPlugin(pluginName); - } @@ -2141,10 +2141,10 @@ index dae84243804b4b076cafb3e1b29bdcf614efc93f..00000000000000000000000000000000 -} diff --git a/src/main/java/co/aikar/util/JSONUtil.java b/src/main/java/co/aikar/util/JSONUtil.java deleted file mode 100644 -index c105a1429ca58b37be265708ec345e00f0d43ed8..0000000000000000000000000000000000000000 +index 232bf09e1a7bc176bfd34b1acb5326a06a92fe79..0000000000000000000000000000000000000000 --- a/src/main/java/co/aikar/util/JSONUtil.java +++ /dev/null -@@ -1,141 +0,0 @@ +@@ -1,138 +0,0 @@ -package co.aikar.util; - -import com.google.common.base.Function; @@ -2152,10 +2152,7 @@ index c105a1429ca58b37be265708ec345e00f0d43ed8..00000000000000000000000000000000 -import com.google.common.collect.Maps; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; --import org.json.simple.JSONArray; --import org.json.simple.JSONObject; - --import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; @@ -2977,35 +2974,45 @@ index 001465eedafa51ac027a4db51cba6223edfe1171..dd98b4886d21ac92d9f9139450258754 // Paper start diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index b412aaf08901d169ac9fc89b36f9d6ccb95c53d3..b2257f3e51a754b7d3d946b434745f22e3305b0a 100644 +index 163e9a0e179dc88be93614ff66ee2be3eccc694f..f4f1a51a3b0c34b87270ba81b705a8ee5d615f8a 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -43,7 +43,6 @@ import org.bukkit.plugin.TimedRegisteredListener; - import org.bukkit.plugin.UnknownDependencyException; - import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; --import org.spigotmc.CustomTimingsHandler; // Spigot - import org.yaml.snakeyaml.error.YAMLException; - - /** -@@ -293,7 +292,7 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -290,22 +290,22 @@ public final class JavaPluginLoader implements PluginLoader { } } - EventExecutor executor = new co.aikar.timings.TimedEventExecutor(new EventExecutor() { // Paper -+ EventExecutor executor = new EventExecutor() { // Paper - @Override - public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { // Paper - try { -@@ -307,7 +306,7 @@ public final class JavaPluginLoader implements PluginLoader { - throw new EventException(t); +- @Override +- public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { // Paper +- try { +- if (!eventClass.isAssignableFrom(event.getClass())) { +- return; +- } +- method.invoke(listener, event); +- } catch (InvocationTargetException ex) { +- throw new EventException(ex.getCause()); +- } catch (Throwable t) { +- throw new EventException(t); ++ // Leaves start - Delete timings ++ // Paper ++ EventExecutor executor = (listener1, event) -> { // Paper ++ try { ++ if (!eventClass.isAssignableFrom(event.getClass())) { ++ return; } ++ method.invoke(listener1, event); ++ } catch (java.lang.reflect.InvocationTargetException ex) { ++ throw new org.bukkit.event.EventException(ex.getCause()); ++ } catch (Throwable t) { ++ throw new org.bukkit.event.EventException(t); } - }, plugin, method, eventClass); // Paper + }; // Paper - if (false) { // Spigot - RL handles useTimings check now - eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); - } else { + eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); ++ // Leaves end - Delete timings + } + return ret; + } diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java deleted file mode 100644 index 5fbacfcf108432c5187aa9a4092d00d7d5b0fd53..0000000000000000000000000000000000000000 diff --git a/leaves-api/paper-patches/features/0002-Add-isShrink-to-EntityResurrectEvent.patch b/leaves-api/paper-patches/features/0002-Add-isShrink-to-EntityResurrectEvent.patch index 9b942579..ae24ff9b 100644 --- a/leaves-api/paper-patches/features/0002-Add-isShrink-to-EntityResurrectEvent.patch +++ b/leaves-api/paper-patches/features/0002-Add-isShrink-to-EntityResurrectEvent.patch @@ -1,42 +1,42 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Wed, 30 Mar 2022 08:58:32 +0000 -Subject: [PATCH] Add isShrink to EntityResurrectEvent +Subject: [PATCH] Add-isShrink-to-EntityResurrectEvent diff --git a/src/main/java/org/bukkit/event/entity/EntityResurrectEvent.java b/src/main/java/org/bukkit/event/entity/EntityResurrectEvent.java -index 2a7426c157f6a06f2491d95d67df95a0fb809926..8fe7d559ad6cbb8f15584c202067250dd55a8ede 100644 +index fa60c0ce5c79757952ad39932e1c5fac8b068811..71fd070aaebfd9fa0fbfd6eb7cd26c8b34120203 100644 --- a/src/main/java/org/bukkit/event/entity/EntityResurrectEvent.java +++ b/src/main/java/org/bukkit/event/entity/EntityResurrectEvent.java -@@ -16,20 +16,44 @@ import org.jetbrains.annotations.Nullable; - public class EntityResurrectEvent extends EntityEvent implements Cancellable { +@@ -17,22 +17,46 @@ public class EntityResurrectEvent extends EntityEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); -- // -+ + private static final HandlerList HANDLER_LIST = new HandlerList(); + +- private final EquipmentSlot hand; +- private boolean cancelled; + private boolean shrink; - - private final EquipmentSlot hand; ++ ++ private final EquipmentSlot hand; @ApiStatus.Internal -- public EntityResurrectEvent(@NotNull LivingEntity what, @Nullable EquipmentSlot hand) { -+ public EntityResurrectEvent(@NotNull LivingEntity what, @Nullable EquipmentSlot hand, boolean shrink) { - super(what); +- public EntityResurrectEvent(@NotNull LivingEntity livingEntity, @Nullable EquipmentSlot hand) { ++ public EntityResurrectEvent(@NotNull LivingEntity livingEntity, @Nullable EquipmentSlot hand, boolean shrink) { + super(livingEntity); + this.shrink = shrink; this.hand = hand; } -+ public EntityResurrectEvent(@NotNull LivingEntity what, @Nullable EquipmentSlot hand) { -+ this(what, hand, true); ++ public EntityResurrectEvent(@NotNull LivingEntity livingEntity, @Nullable EquipmentSlot hand) { ++ this(livingEntity, hand, true); + } + + @ApiStatus.Internal @Deprecated(since = "1.19.2", forRemoval = true) - public EntityResurrectEvent(@NotNull LivingEntity what) { -- this(what, null); -+ this(what, null, true); -+ } -+ + public EntityResurrectEvent(@NotNull LivingEntity livingEntity) { + this(livingEntity, null); + } + + /** + * Get is shrink item + * @@ -53,6 +53,8 @@ index 2a7426c157f6a06f2491d95d67df95a0fb809926..8fe7d559ad6cbb8f15584c202067250d + */ + public void setShrink(boolean shrink) { + this.shrink = shrink; - } - ++ } ++ @NotNull + @Override + public LivingEntity getEntity() { diff --git a/leaves-api/paper-patches/features/0003-Add-fakeplayer-api.patch b/leaves-api/paper-patches/features/0003-Add-fakeplayer-api.patch index 0e840f2c..7ffd9c63 100644 --- a/leaves-api/paper-patches/features/0003-Add-fakeplayer-api.patch +++ b/leaves-api/paper-patches/features/0003-Add-fakeplayer-api.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add fakeplayer api diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 4eb723afaca049a816d16370b383fa37441eafd4..e1c6974cfd96b406314901862c2d92ad0a4ba8f2 100644 +index ee791bf6299d654fb56300fbda1f6ea50620a3e2..aa06af1e53e556a5d37aeeb7ac7103bdc6eff472 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2996,4 +2996,15 @@ public final class Bukkit { +@@ -2997,4 +2997,15 @@ public final class Bukkit { public static void restart() { server.restart(); } @@ -25,7 +25,7 @@ index 4eb723afaca049a816d16370b383fa37441eafd4..e1c6974cfd96b406314901862c2d92ad + // Leaves end - Bot API } diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0c1f3053ecb415a6dfbbe283bae8c1f6d8477e9c..e42fa3dc7f70a5e4426564f26d471c5bfc3d57f2 100644 +index 7dbfff8e0d86ba4533568a8f4182506d8a065b63..41474dd9ea63e00efde93cff3df2c2e0c956e7ba 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -66,6 +66,7 @@ import org.jetbrains.annotations.ApiStatus; @@ -36,7 +36,7 @@ index 0c1f3053ecb415a6dfbbe283bae8c1f6d8477e9c..e42fa3dc7f70a5e4426564f26d471c5b /** * Represents a server implementation. -@@ -2698,4 +2699,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -2705,4 +2706,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi */ void allowPausing(@NotNull org.bukkit.plugin.Plugin plugin, boolean value); // Paper end - API to check if the server is sleeping diff --git a/leaves-api/paper-patches/features/0004-Force-peaceful-mode-switch.patch b/leaves-api/paper-patches/features/0004-Force-peaceful-mode-switch.patch index fb121ba7..82945e86 100644 --- a/leaves-api/paper-patches/features/0004-Force-peaceful-mode-switch.patch +++ b/leaves-api/paper-patches/features/0004-Force-peaceful-mode-switch.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Force peaceful mode switch diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index bff01411f4b2d3ecd9e6d807c3f450d72c108323..aae996e55cfda36adcca50065e05b5ecc4129614 100644 +index a8b64f78bf3c453094074b4b4d3c8fd07b9eb273..ed2bcc30cec91d3266c3d184b89b96bac6fb1f67 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -4351,6 +4351,12 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -4358,6 +4358,12 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient void setSendViewDistance(int viewDistance); // Paper end - view distance api diff --git a/leaves-api/paper-patches/features/0005-Replay-Mod-API.patch b/leaves-api/paper-patches/features/0005-Replay-Mod-API.patch index 65ca9cf8..ec9dae9a 100644 --- a/leaves-api/paper-patches/features/0005-Replay-Mod-API.patch +++ b/leaves-api/paper-patches/features/0005-Replay-Mod-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Replay Mod API diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index e1c6974cfd96b406314901862c2d92ad0a4ba8f2..27bd3867836744a6e10507d165215ebf8dd7da53 100644 +index aa06af1e53e556a5d37aeeb7ac7103bdc6eff472..d45d8d4eb673526b3d22cf9106a7d15dbdd94500 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -3007,4 +3007,10 @@ public final class Bukkit { +@@ -3008,4 +3008,10 @@ public final class Bukkit { return server.getBotManager(); } // Leaves end - Bot API @@ -20,7 +20,7 @@ index e1c6974cfd96b406314901862c2d92ad0a4ba8f2..27bd3867836744a6e10507d165215ebf + // Leaves end - Photographer API } diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index e42fa3dc7f70a5e4426564f26d471c5bfc3d57f2..f4f83b1534a90127a77420a1768cd4b255a04868 100644 +index 41474dd9ea63e00efde93cff3df2c2e0c956e7ba..2b9cf972d18b43531bdbeb04eb5a8e5cdf909bbd 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -67,6 +67,7 @@ import org.jetbrains.annotations.Contract; @@ -31,7 +31,7 @@ index e42fa3dc7f70a5e4426564f26d471c5bfc3d57f2..f4f83b1534a90127a77420a1768cd4b2 /** * Represents a server implementation. -@@ -2708,4 +2709,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -2715,4 +2716,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi */ @NotNull BotManager getBotManager(); // Leaves end - Bot API diff --git a/leaves-api/paper-patches/features/0006-Bytebuf-API.patch b/leaves-api/paper-patches/features/0006-Bytebuf-API.patch index 4c84b72f..5f7cbf44 100644 --- a/leaves-api/paper-patches/features/0006-Bytebuf-API.patch +++ b/leaves-api/paper-patches/features/0006-Bytebuf-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Bytebuf API diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 27bd3867836744a6e10507d165215ebf8dd7da53..190e532fd3ddaf78eae3ea0ba2b4b986ab5f9540 100644 +index d45d8d4eb673526b3d22cf9106a7d15dbdd94500..28ac7ef197dd6a568c01f762a787aa1ca396017b 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -3013,4 +3013,10 @@ public final class Bukkit { +@@ -3014,4 +3014,10 @@ public final class Bukkit { return server.getPhotographerManager(); } // Leaves end - Photographer API @@ -20,10 +20,10 @@ index 27bd3867836744a6e10507d165215ebf8dd7da53..190e532fd3ddaf78eae3ea0ba2b4b986 + // Leaves end - Bytebuf API } diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index f4f83b1534a90127a77420a1768cd4b255a04868..8d4c10d7d8b3982a960ca2cee52ce069b1916c24 100644 +index 2b9cf972d18b43531bdbeb04eb5a8e5cdf909bbd..079825a5ed671eac5f4f529393882a32d4b557c5 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -2713,4 +2713,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -2720,4 +2720,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi // Leaves start - Photographer API @NotNull PhotographerManager getPhotographerManager(); // Leaves end - Photographer API @@ -33,10 +33,10 @@ index f4f83b1534a90127a77420a1768cd4b255a04868..8d4c10d7d8b3982a960ca2cee52ce069 + // Leaves end - Bytebuf API } diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 494dca2ee48a03953d47050b178496df12bc48c5..b429eb9a0326460a8841a1cfdfd6cd13c02ec2b7 100644 +index 7b9324d121d39ef75dc4d709831472598c1c50a0..7349663d3dd6d4d45dc12f2dbfb5337bcd0efbf2 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3853,6 +3853,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -3829,6 +3829,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM boolean isChunkSent(long chunkKey); // Paper end diff --git a/leaves-api/paper-patches/features/0007-Revert-raid-changes.patch b/leaves-api/paper-patches/features/0007-Revert-raid-changes.patch index 3526e298..32048e02 100644 --- a/leaves-api/paper-patches/features/0007-Revert-raid-changes.patch +++ b/leaves-api/paper-patches/features/0007-Revert-raid-changes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Revert raid changes diff --git a/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java b/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java -index f6218d317af4f4d83292a10abdf583fb01824232..3eb836575307116ce0668eadd6a6ee0a9aafc7cd 100644 +index 22e14ba522510d659c191d72536cde895458d9ed..253f937dbd130fac064963b4af7572e1302fee8f 100644 --- a/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java +++ b/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java -@@ -219,9 +219,7 @@ public class EntityPotionEffectEvent extends EntityEvent implements Cancellable +@@ -221,9 +221,7 @@ public class EntityPotionEffectEvent extends EntityEvent implements Cancellable /** * When a player gets bad omen after killing a patrol captain. * diff --git a/leaves-api/paper-patches/features/0008-Fix-SculkCatalyst-exp-skip.patch b/leaves-api/paper-patches/features/0008-Fix-SculkCatalyst-exp-skip.patch index 5db9e044..23ba4cfc 100644 --- a/leaves-api/paper-patches/features/0008-Fix-SculkCatalyst-exp-skip.patch +++ b/leaves-api/paper-patches/features/0008-Fix-SculkCatalyst-exp-skip.patch @@ -5,36 +5,40 @@ Subject: [PATCH] Fix SculkCatalyst exp skip diff --git a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java -index 42ffb81708b327f765ba3235fdd1ab69cd7589fd..0a7e37420f8d024ffba1fd1c52edc50c10408e6e 100644 +index 76c08499b704a6cb0cb95ce69b9a9248d69cc127..316bbf8c95e4803190897d66a0c7d8b4316f4164 100644 --- a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java -@@ -25,17 +25,25 @@ public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Ca +@@ -28,6 +28,8 @@ public class EntityDeathEvent extends EntityEvent implements Cancellable { private float deathSoundVolume; private float deathSoundPitch; - // Paper end + + private int rewardExp; // Leaves - exp fix ++ + private boolean cancelled; - public EntityDeathEvent(@NotNull final LivingEntity entity, @NotNull DamageSource damageSource, @NotNull final List drops) { - this(entity, damageSource, drops, 0); - } + @ApiStatus.Internal +@@ -37,12 +39,19 @@ public class EntityDeathEvent extends EntityEvent implements Cancellable { - public EntityDeathEvent(@NotNull final LivingEntity what, @NotNull DamageSource damageSource, @NotNull final List drops, final int droppedExp) { -+ // Leaves start - exp fix -+ this(what, damageSource, drops, droppedExp, droppedExp); + @ApiStatus.Internal + public EntityDeathEvent(@NotNull final LivingEntity livingEntity, @NotNull DamageSource damageSource, @NotNull final List drops, final int droppedExp) { ++ // Leaves start - exp fix ++ this(livingEntity, damageSource, drops, droppedExp, droppedExp); + } + -+ public EntityDeathEvent(@NotNull final LivingEntity what, @NotNull DamageSource damageSource, @NotNull final List drops, final int droppedExp, final int rewardExp) { - super(what); ++ @ApiStatus.Internal ++ public EntityDeathEvent(@NotNull final LivingEntity livingEntity, @NotNull DamageSource damageSource, @NotNull final List drops, final int droppedExp, final int rewardExp) { + super(livingEntity); this.damageSource = damageSource; this.drops = drops; this.dropExp = droppedExp; + this.rewardExp = rewardExp; } +- + // Leaves end - exp fix - @NotNull @Override -@@ -75,6 +83,7 @@ public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Ca + public LivingEntity getEntity() { +@@ -81,6 +90,7 @@ public class EntityDeathEvent extends EntityEvent implements Cancellable { */ public void setDroppedExp(int exp) { this.dropExp = exp; @@ -42,11 +46,10 @@ index 42ffb81708b327f765ba3235fdd1ab69cd7589fd..0a7e37420f8d024ffba1fd1c52edc50c } /** -@@ -226,4 +235,14 @@ public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Ca +@@ -210,6 +220,16 @@ public class EntityDeathEvent extends EntityEvent implements Cancellable { this.deathSoundPitch = pitch; } - // Paper end -+ + + // Leaves start - exp fix + public int getRewardExp() { + return rewardExp; @@ -56,4 +59,7 @@ index 42ffb81708b327f765ba3235fdd1ab69cd7589fd..0a7e37420f8d024ffba1fd1c52edc50c + this.rewardExp = rewardExp; + } + // Leaves end - exp fix - } ++ + @Override + public boolean isCancelled() { + return this.cancelled; diff --git a/leaves-server/build.gradle.kts.patch b/leaves-server/build.gradle.kts.patch index 0e42045c..f44caa40 100644 --- a/leaves-server/build.gradle.kts.patch +++ b/leaves-server/build.gradle.kts.patch @@ -1,9 +1,17 @@ --- a/paper-server/build.gradle.kts +++ b/paper-server/build.gradle.kts -@@ -5,14 +_,15 @@ +@@ -1,22 +_,20 @@ + import io.papermc.paperweight.attribute.DevBundleOutput + import io.papermc.paperweight.util.* +-import io.papermc.paperweight.util.data.FileEntry +-import paper.libs.com.google.gson.annotations.SerializedName + import java.time.Instant +-import kotlin.io.path.readText + plugins { `java-library` `maven-publish` + idea - id("io.papermc.paperweight.core") + id("org.leavesmc.leavesweight.core") // Leaves - build change } @@ -12,15 +20,15 @@ +val leavesMavenPublicUrl = "https://repo.leavesmc.com/snapshots/" dependencies { - mache("io.papermc:mache:1.21.4+build.7") + mache("io.papermc:mache:1.21.5+build.1") - paperclip("io.papermc:paperclip:3.0.3") + leavesclip("org.leavesmc:leavesclip:2.0.1") // Leaves - build change testRuntimeOnly("org.junit.platform:junit-platform-launcher") } -@@ -21,6 +_,18 @@ - // macheOldPath = file("F:\\Projects\\PaperTooling\\mache\\versions\\1.21.4\\src\\main\\java") - // gitFilePatches = true +@@ -28,6 +_,18 @@ + // oldPaperCommit = "f4f275519f7c1fbe9db173b7144a4fe81440e365" + //} + // Leaves start - build change + val leaves = forks.register("leaves") { @@ -35,9 +43,9 @@ + // Leaves end - build change + spigot { - buildDataRef = "3edaf46ec1eed4115ce1b18d2846cded42577e42" - packageVersion = "v1_21_R3" // also needs to be updated in MappingEnvironment -@@ -43,6 +_,7 @@ + buildDataRef = "702e1a0a5072b2c4082371d5228cb30525687efc" + packageVersion = "v1_21_R4" // also needs to be updated in MappingEnvironment +@@ -50,6 +_,7 @@ libraryRepositories.addAll( "https://repo.maven.apache.org/maven2/", paperMavenPublicUrl, @@ -45,7 +53,7 @@ ) } -@@ -101,7 +_,21 @@ +@@ -108,7 +_,22 @@ } } @@ -65,10 +73,11 @@ + java { srcDir("../paper-server/src/log4jPlugins/java") } +} +// Leaves end - build change ++ configurations.named(log4jPlugins.compileClasspathConfigurationName) { extendsFrom(configurations.compileClasspath.get()) } -@@ -119,7 +_,13 @@ +@@ -130,7 +_,13 @@ } dependencies { @@ -83,8 +92,8 @@ implementation("ca.spottedleaf:concurrentutil:0.0.3") implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21 -@@ -177,6 +_,16 @@ - implementation("me.lucko:spark-paper:1.10.119-20241121.092015-1") +@@ -194,6 +_,16 @@ + implementation("me.lucko:spark-paper:1.10.133-20250413.112336-1") } +// Leaves start - hide irrelevant compilation warnings @@ -100,7 +109,7 @@ tasks.jar { manifest { val git = Git(rootProject.layout.projectDirectory.path) -@@ -189,14 +_,14 @@ +@@ -206,14 +_,14 @@ val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim() attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", @@ -120,7 +129,24 @@ "Build-Number" to (build ?: ""), "Build-Time" to buildTime.toString(), "Git-Branch" to gitBranch, -@@ -317,13 +_,23 @@ +@@ -268,11 +_,16 @@ + } + + val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath() ++// Leaves start - remove (TEMP) ++// I don't know what happened, but my ide can't resolve this configuration ++/* + idea { + module { + generatedSourceDirs.add(generatedDir.toFile()) + } + } ++ */ ++// Leaves end - remove (TEMP) + sourceSets { + main { + java { +@@ -360,13 +_,24 @@ classpath(tasks.createReobfBundlerJar.flatMap { it.outputZip }) mainClass.set(null as String?) } @@ -134,6 +160,7 @@ - classpath(tasks.createReobfPaperclipJar.flatMap { it.outputZip }) - mainClass.set(null as String?) -} ++ +// Leaves start - build change +tasks.registerRunTask("runLeavesclip") { + description = "Spin up a test server from the Mojang mapped Leavesclip jar" diff --git a/leaves-server/build.gradle.kts.patch.bak b/leaves-server/build.gradle.kts.patch.bak new file mode 100644 index 00000000..e69735b5 --- /dev/null +++ b/leaves-server/build.gradle.kts.patch.bak @@ -0,0 +1,156 @@ +--- a/paper-server/build.gradle.kts ++++ b/paper-server/build.gradle.kts +@@ -5,14 +_,15 @@ + plugins { + `java-library` + `maven-publish` +- id("io.papermc.paperweight.core") ++ id("org.leavesmc.leavesweight.core") // Leaves - build change + } + + val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" ++val leavesMavenPublicUrl = "https://repo.leavesmc.com/snapshots/" + + dependencies { + mache("io.papermc:mache:1.21.4+build.7") +- paperclip("io.papermc:paperclip:3.0.3") ++ leavesclip("org.leavesmc:leavesclip:2.0.1") // Leaves - build change + testRuntimeOnly("org.junit.platform:junit-platform-launcher") + } + +@@ -21,6 +_,18 @@ + // macheOldPath = file("F:\\Projects\\PaperTooling\\mache\\versions\\1.21.4\\src\\main\\java") + // gitFilePatches = true + ++ // Leaves start - build change ++ val leaves = forks.register("leaves") { ++ upstream.patchDir("paperServer") { ++ upstreamPath = "paper-server" ++ excludes = setOf("src/minecraft", "patches", "build.gradle.kts") ++ patchesDir = rootDirectory.dir("leaves-server/paper-patches") ++ outputDir = rootDirectory.dir("paper-server") ++ } ++ } ++ activeFork = leaves ++ // Leaves end - build change ++ + spigot { + buildDataRef = "3edaf46ec1eed4115ce1b18d2846cded42577e42" + packageVersion = "v1_21_R3" // also needs to be updated in MappingEnvironment +@@ -43,6 +_,7 @@ + libraryRepositories.addAll( + "https://repo.maven.apache.org/maven2/", + paperMavenPublicUrl, ++ leavesMavenPublicUrl + ) + } + +@@ -101,7 +_,21 @@ + } + } + +-val log4jPlugins = sourceSets.create("log4jPlugins") ++// Leaves start - build change ++sourceSets { ++ main { ++ java { srcDir("../paper-server/src/main/java") } ++ resources { srcDir("../paper-server/src/main/resources") } ++ } ++ test { ++ java { srcDir("../paper-server/src/test/java") } ++ resources { srcDir("../paper-server/src/test/resources") } ++ } ++} ++val log4jPlugins = sourceSets.create("log4jPlugins") { ++ java { srcDir("../paper-server/src/log4jPlugins/java") } ++} ++// Leaves end - build change + configurations.named(log4jPlugins.compileClasspathConfigurationName) { + extendsFrom(configurations.compileClasspath.get()) + } +@@ -119,7 +_,13 @@ + } + + dependencies { +- implementation(project(":paper-api")) ++ implementation(project(":leaves-api")) // Leaves - build change ++ // Leaves start - linear ++ implementation("com.github.luben:zstd-jni:1.5.4-1") ++ implementation("org.lz4:lz4-java:1.8.0") ++ implementation("net.openhft:zero-allocation-hashing:0.16") ++ // Leaves end - linear ++ implementation("org.spongepowered:configurate-hocon:4.2.0-SNAPSHOT") // Leaves - leaves plugins + implementation("ca.spottedleaf:concurrentutil:0.0.3") + implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ + implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21 +@@ -177,6 +_,16 @@ + implementation("me.lucko:spark-paper:1.10.119-20241121.092015-1") + } + ++// Leaves start - hide irrelevant compilation warnings ++tasks.withType { ++ val compilerArgs = options.compilerArgs ++ compilerArgs.add("-Xlint:-module") ++ compilerArgs.add("-Xlint:-removal") ++ compilerArgs.add("-Xlint:-dep-ann") ++ compilerArgs.add("--add-modules=jdk.incubator.vector") // SIMD ++} ++// Leaves end - hide irrelevant compilation warnings ++ + tasks.jar { + manifest { + val git = Git(rootProject.layout.projectDirectory.path) +@@ -189,14 +_,14 @@ + val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim() + attributes( + "Main-Class" to "org.bukkit.craftbukkit.Main", +- "Implementation-Title" to "Paper", ++ "Implementation-Title" to "Leaves", // Leaves - build change + "Implementation-Version" to implementationVersion, + "Implementation-Vendor" to date, +- "Specification-Title" to "Paper", ++ "Specification-Title" to "Leaves", // Leaves - build change + "Specification-Version" to project.version, +- "Specification-Vendor" to "Paper Team", +- "Brand-Id" to "papermc:paper", +- "Brand-Name" to "Paper", ++ "Specification-Vendor" to "Leaves Team", // Leaves - build change ++ "Brand-Id" to "leavesmc:leaves", // Leaves - build change ++ "Brand-Name" to "Leaves", // Leaves - build change + "Build-Number" to (build ?: ""), + "Build-Time" to buildTime.toString(), + "Git-Branch" to gitBranch, +@@ -317,13 +_,23 @@ + classpath(tasks.createReobfBundlerJar.flatMap { it.outputZip }) + mainClass.set(null as String?) + } +-tasks.registerRunTask("runPaperclip") { +- description = "Spin up a test server from the Mojang mapped Paperclip jar" +- classpath(tasks.createMojmapPaperclipJar.flatMap { it.outputZip }) +- mainClass.set(null as String?) +-} +-tasks.registerRunTask("runReobfPaperclip") { +- description = "Spin up a test server from the reobf Paperclip jar" +- classpath(tasks.createReobfPaperclipJar.flatMap { it.outputZip }) +- mainClass.set(null as String?) +-} ++// Leaves start - build change ++tasks.registerRunTask("runLeavesclip") { ++ description = "Spin up a test server from the Mojang mapped Leavesclip jar" ++ classpath(tasks.createMojmapLeavesclipJar.flatMap { it.outputZip }) ++ mainClass.set(null as String?) ++} ++tasks.registerRunTask("runReobfLeavesclip") { ++ description = "Spin up a test server from the reobf Leavesclip jar" ++ classpath(tasks.createReobfLeavesclipJar.flatMap { it.outputZip }) ++ mainClass.set(null as String?) ++} ++// Leaves end - build change ++ ++// Leaves start - create config file ++tasks.registerRunTask("createLeavesConfig") { ++ description = "Create a new leaves.yml" ++ mainClass = "org.leavesmc.leaves.config.GlobalConfigCreator" ++ classpath(sourceSets.main.map { it.runtimeClasspath }) ++} ++// Leaves end - create config file \ No newline at end of file