Skip to content

Commit

Permalink
Update Paper
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Dec 1, 2024
1 parent 46898af commit 8045636
Show file tree
Hide file tree
Showing 38 changed files with 199 additions and 213 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
group=org.leavesmc.leaves
version=1.21.3-R0.1-SNAPSHOT
mcVersion=1.21.3
paperRef=be886cf4e7ba906a3e79d9d38835d35abf60a0ce
paperRef=27e4ddcd067d4825eb01cb05d6975c46252eeafa
preVersion=true
org.gradle.jvmargs=-Xmx2G
org.gradle.caching=true
Expand Down
12 changes: 6 additions & 6 deletions patches/api/0003-Add-fakeplayer-api.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 391a1e3e07657a404520c1462507a2c731f32b27..2081370003a27abb69f7d5da37d5fb0085c39944 100644
index 5ce98e09e9bfcae45896401c69578aa879222893..cb7e06ad207239a5626fc475c46d991fabb48293 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2941,6 +2941,17 @@ public final class Bukkit {
@@ -2964,6 +2964,17 @@ public final class Bukkit {
}
// Paper end - Folia region threading API

Expand All @@ -27,7 +27,7 @@ index 391a1e3e07657a404520c1462507a2c731f32b27..2081370003a27abb69f7d5da37d5fb00
public static Server.Spigot spigot() {
return server.spigot();
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index cbe69a0267981173fe8f7d715764d982bd9dcc8d..c9ded0024dcbf68400a65a12065cdcbb374d3789 100644
index 0bae85d3489b628d2a2542f3c7b6f91f4a7c4af5..967bb7ba476f494ac8bfebb599f260017176f3e3 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -62,6 +62,7 @@ import org.jetbrains.annotations.ApiStatus;
Expand All @@ -38,10 +38,10 @@ index cbe69a0267981173fe8f7d715764d982bd9dcc8d..c9ded0024dcbf68400a65a12065cdcbb

/**
* Represents a server implementation.
@@ -2580,4 +2581,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2615,4 +2616,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
boolean isOwnedByCurrentRegion(@NotNull Entity entity);
// Paper end - Folia region threading API
void allowPausing(@NotNull org.bukkit.plugin.Plugin plugin, boolean value);
// Paper end - API to check if the server is sleeping
+
+ // Leaves start - Bot API
+ /**
Expand Down
4 changes: 2 additions & 2 deletions patches/api/0008-Force-peaceful-mode-switch.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 ef32a937e6faf1e8a5d6b1207986715bae5a246c..29343b0f5c5b91e66e13c2d8d5e1952762af8526 100644
index 7a439c99fc4c5ee17d674460c8e58a9fe0c64e02..3d5893c4cb6fc914ff2dbbb2267420ec8653dac3 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -4277,6 +4277,12 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -4314,6 +4314,12 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
void setSendViewDistance(int viewDistance);
// Paper end - view distance api

Expand Down
8 changes: 4 additions & 4 deletions patches/api/0009-Replay-Mod-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 2081370003a27abb69f7d5da37d5fb0085c39944..00673245db6684e1ad123a4f4767f67a4d3f2d2a 100644
index cb7e06ad207239a5626fc475c46d991fabb48293..e37015328e3e53ae5f960c8235ef827b7abe329d 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2951,6 +2951,11 @@ public final class Bukkit {
@@ -2974,6 +2974,11 @@ public final class Bukkit {
return server.getBotManager();
}
// Leaves end - Bot API
Expand All @@ -21,7 +21,7 @@ index 2081370003a27abb69f7d5da37d5fb0085c39944..00673245db6684e1ad123a4f4767f67a
@NotNull
public static Server.Spigot spigot() {
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index c9ded0024dcbf68400a65a12065cdcbb374d3789..39af9b6cec72bcc57058779f8dbdbbe704cabdb6 100644
index 967bb7ba476f494ac8bfebb599f260017176f3e3..cc86476f68e6934a3f8e6a5404876a39b943a926 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -63,6 +63,7 @@ import org.jetbrains.annotations.Contract;
Expand All @@ -32,7 +32,7 @@ index c9ded0024dcbf68400a65a12065cdcbb374d3789..39af9b6cec72bcc57058779f8dbdbbe7

/**
* Represents a server implementation.
@@ -2590,4 +2591,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2625,4 +2626,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull BotManager getBotManager();
// Leaves end - Bot API
Expand Down
8 changes: 4 additions & 4 deletions patches/api/0010-Bytebuf-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 00673245db6684e1ad123a4f4767f67a4d3f2d2a..4ef7946af0acd999c4225e52d0a4c0e9d0616380 100644
index e37015328e3e53ae5f960c8235ef827b7abe329d..d4d30b4da5e05d1f60f9fbb41a7a11b98d7cf6a0 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2957,6 +2957,12 @@ public final class Bukkit {
@@ -2980,6 +2980,12 @@ public final class Bukkit {
}
// Leaves end - Photographer API

Expand All @@ -22,10 +22,10 @@ index 00673245db6684e1ad123a4f4767f67a4d3f2d2a..4ef7946af0acd999c4225e52d0a4c0e9
public static Server.Spigot spigot() {
return server.spigot();
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 39af9b6cec72bcc57058779f8dbdbbe704cabdb6..30af8322c3bbd3e189e3fde207416a7eb8552d06 100644
index cc86476f68e6934a3f8e6a5404876a39b943a926..6a5afc818073989b6d3a108261aeff285409cfc0 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2594,4 +2594,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2629,4 +2629,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
// Leaves start - Photographer API
@NotNull PhotographerManager getPhotographerManager();
// Leaves end - Photographer API
Expand Down
22 changes: 11 additions & 11 deletions patches/server/0001-Build-changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Build changes


diff --git a/build.gradle.kts b/build.gradle.kts
index c209eb393670fd8d6c97ca65a801c8032b582a35..7e5af232b6099dcc5336ca1ed9f19cc4ae665b01 100644
index faf3e3fd72e8c915e7a4803dacbe1bb576c6663e..d88a9d1908373ba44143013cda1ae51477a835cf 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -25,7 +25,7 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider {
Expand All @@ -15,9 +15,9 @@ index c209eb393670fd8d6c97ca65a801c8032b582a35..7e5af232b6099dcc5336ca1ed9f19cc4
- implementation(project(":paper-api"))
+ implementation(project(":leaves-api")) // Leaves - build change
// Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0")
@@ -85,6 +85,15 @@ paperweight {
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
@@ -86,6 +86,15 @@ paperweight {
craftBukkitPackageVersion.set("v1_21_R2") // also needs to be updated in MappingEnvironment
}

Expand All @@ -33,7 +33,7 @@ index c209eb393670fd8d6c97ca65a801c8032b582a35..7e5af232b6099dcc5336ca1ed9f19cc4
tasks.jar {
archiveClassifier.set("dev")

@@ -98,14 +107,14 @@ tasks.jar {
@@ -99,14 +108,14 @@ tasks.jar {
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
Expand All @@ -53,7 +53,7 @@ index c209eb393670fd8d6c97ca65a801c8032b582a35..7e5af232b6099dcc5336ca1ed9f19cc4
"Build-Number" to (build ?: ""),
"Build-Time" to Instant.now().toString(),
"Git-Branch" to gitBranch, // Paper
@@ -171,7 +180,7 @@ fun TaskContainer.registerRunTask(
@@ -172,7 +181,7 @@ fun TaskContainer.registerRunTask(
name: String,
block: JavaExec.() -> Unit
): TaskProvider<JavaExec> = register<JavaExec>(name) {
Expand All @@ -62,7 +62,7 @@ index c209eb393670fd8d6c97ca65a801c8032b582a35..7e5af232b6099dcc5336ca1ed9f19cc4
mainClass.set("org.bukkit.craftbukkit.Main")
standardInput = System.`in`
workingDir = rootProject.layout.projectDirectory
@@ -240,13 +249,13 @@ tasks.registerRunTask("runReobfBundler") {
@@ -241,13 +250,13 @@ tasks.registerRunTask("runReobfBundler") {
classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreateBundlerJar>("createReobfBundlerJar").flatMap { it.outputZip })
mainClass.set(null as String?)
}
Expand Down Expand Up @@ -197,10 +197,10 @@ index 790bad0494454ca12ee152e3de6da3da634d9b20..c060857cb0551fff8f5033553b887f3a
private static final String BUILD_DEV = "DEV";

diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 64b56abf8900d0424100da460fc68ac964394793..9d5de69b85aff3d94f08c212eed76bd5ed0e39e9 100644
index 780582ebaa8deb0c0b0c8de17de5abcebafa4bd3..5201b1aaedabdf6021ea9ac3f84be70a6d03aa8f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1262,7 +1262,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1263,7 +1263,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
LOGGER.info("*************************************************************************************");
LOGGER.info("This is the first time you're starting this server.");
LOGGER.info("It's recommended you read our 'Getting Started' documentation for guidance.");
Expand All @@ -209,7 +209,7 @@ index 64b56abf8900d0424100da460fc68ac964394793..9d5de69b85aff3d94f08c212eed76bd5
LOGGER.info("*************************************************************************************");
}
// Paper end - Add onboarding message for initial server start
@@ -2008,7 +2008,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2010,7 +2010,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

@DontObfuscate
public String getServerModName() {
Expand Down Expand Up @@ -248,7 +248,7 @@ index 759062d219ff490a3cb19e710c4d18e3e08288e0..3952428c02fe87477f4139f4fa983815

javax.swing.JLabel jLabel = new javax.swing.JLabel("If you need help setting up your server you can visit:");
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index a7524d3853d5b67b6385d2b74832b9267503dfe6..44bbfc4eba78dfa268696c79b1d15c8f1271bbb1 100644
index be0d38544395a9b3befb898bb961f34e32fe9509..a41e6f5dc2d5516f081d7340e2dacffaf5663485 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -267,7 +267,7 @@ public class Main {
Expand Down
12 changes: 6 additions & 6 deletions patches/server/0004-Leaves-Server-Utils.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ Subject: [PATCH] Leaves Server Utils


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 8be1b051543cda2b2e9e3d337834757e53f442de..70a3ffdcd7b515207c1c28ffcdf22cc166c507f2 100644
index a15546e433ebba6c0de01bdaaef201a3d99a87b5..922996adcf2b85e55a934191e90a12c42f169b0f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -432,6 +432,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
private UUID originWorld;
@@ -389,6 +389,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
public boolean fixedPose = false; // Paper - Expand Pose API
private final int despawnTime; // Paper - entity despawn time limit
+ private CompoundTag leavesData = new CompoundTag(); // Leaves - Leaves ex data

public void setOrigin(@javax.annotation.Nonnull Location location) {
this.origin = location.toVector();
@@ -2726,6 +2727,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2690,6 +2691,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
nbttagcompound.putBoolean("Paper.FreezeLock", true);
}
// Paper end
+ nbttagcompound.put("Leaves.Data", leavesData); // Leaves - leaves ex data
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -2874,6 +2876,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2838,6 +2840,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
freezeLocked = nbt.getBoolean("Paper.FreezeLock");
}
// Paper end
Expand All @@ -36,7 +36,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..70a3ffdcd7b515207c1c28ffcdf22cc1

} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
@@ -5361,4 +5368,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -5325,4 +5332,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return ((net.minecraft.server.level.ServerLevel) this.level).isPositionEntityTicking(this.blockPosition());
}
// Paper end - Expose entity id counter
Expand Down
42 changes: 14 additions & 28 deletions patches/server/0006-Leaves-Server-Config-And-Command.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Leaves Server Config And Command


diff --git a/build.gradle.kts b/build.gradle.kts
index 7e5af232b6099dcc5336ca1ed9f19cc4ae665b01..0c9dd2d83a9b0a044fb11378690bbcb46c956fa0 100644
index d88a9d1908373ba44143013cda1ae51477a835cf..b8132401ddaedf13bc9ddc74524166d0e0dcf419 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -239,6 +239,14 @@ tasks.registerRunTask("runDevServer") {
@@ -240,6 +240,14 @@ tasks.registerRunTask("runDevServer") {
jvmArgs("-DPaper.pushPaperAssetsRoot=true")
}

Expand Down Expand Up @@ -38,18 +38,18 @@ index faeb700647522379046f3cb3abcf478ff5aae95d..a8c5fa172b01b85df51fa3b4d20b6c4f

this.setPvpAllowed(dedicatedserverproperties.pvp);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index dfddcfb1fe1679adaecf75375757dca720e76ce1..5d0af29e94c3442c065f828d1be61f91d6161c68 100644
index ac8af406180bc680d46e8edc3da0fc2e5211345a..3d18ffbf3604705d8b99f69df156392dfed1863b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1102,6 +1102,7 @@ public final class CraftServer implements Server {
@@ -1114,6 +1114,7 @@ public final class CraftServer implements Server {
playerMetadata.removeAll(plugin);
}
// Paper end
+ org.leavesmc.leaves.LeavesConfig.init((File) console.options.valueOf("leaves-settings")); // Leaves - Server Config
this.reloadData();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
@@ -3018,6 +3019,14 @@ public final class CraftServer implements Server {
@@ -3030,6 +3031,14 @@ public final class CraftServer implements Server {
{
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
}
Expand All @@ -65,7 +65,7 @@ index dfddcfb1fe1679adaecf75375757dca720e76ce1..5d0af29e94c3442c065f828d1be61f91
@Override
public void restart() {
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 44bbfc4eba78dfa268696c79b1d15c8f1271bbb1..a88ff89928c322fa1c42987a06991a56ace1f19c 100644
index a41e6f5dc2d5516f081d7340e2dacffaf5663485..8f1230fcfa4fc27b513a4eb1023f107c8c7dd818 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -168,6 +168,14 @@ public class Main {
Expand Down Expand Up @@ -1689,10 +1689,10 @@ index 0000000000000000000000000000000000000000..1e109a8b95f7dd25f68f7b3d2115c8cf
+}
diff --git a/src/main/java/org/leavesmc/leaves/config/GlobalConfigCreator.java b/src/main/java/org/leavesmc/leaves/config/GlobalConfigCreator.java
new file mode 100644
index 0000000000000000000000000000000000000000..79f1d346fcd42dc12e54376420d93b1b0f064056
index 0000000000000000000000000000000000000000..baa8f15c5ef092f287004b8266b7f7cee1392260
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/config/GlobalConfigCreator.java
@@ -0,0 +1,90 @@
@@ -0,0 +1,83 @@
+package org.leavesmc.leaves.config;
+
+import org.bukkit.configuration.file.YamlConfiguration;
Expand Down Expand Up @@ -1739,16 +1739,9 @@ index 0000000000000000000000000000000000000000..79f1d346fcd42dc12e54376420d93b1b
+
+ private static void initCategory(@NotNull Field categoryField, @NotNull GlobalConfigCategory globalCategory, @Nullable Object upstreamField, @NotNull String upstreamPath) {
+ try {
+ Class<?> categoryClass = categoryField.getType();
+
+ Constructor<?> constructor = categoryClass.getDeclaredConstructor();
+ constructor.setAccessible(true);
+ Object category = constructor.newInstance();
+ categoryField.set(upstreamField, category);
+
+ Object category = categoryField.get(upstreamField);
+ String categoryPath = upstreamPath + globalCategory.value() + ".";
+
+ for (Field field : categoryClass.getDeclaredFields()) {
+ for (Field field : categoryField.getType().getDeclaredFields()) {
+ initField(field, category, categoryPath);
+ }
+ } catch (Exception e) {
Expand Down Expand Up @@ -1785,10 +1778,10 @@ index 0000000000000000000000000000000000000000..79f1d346fcd42dc12e54376420d93b1b
+}
diff --git a/src/main/java/org/leavesmc/leaves/config/GlobalConfigManager.java b/src/main/java/org/leavesmc/leaves/config/GlobalConfigManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..191717863d411178405f19b9b66d1ece2ba36feb
index 0000000000000000000000000000000000000000..adc023d5b669d712ae7eae740f5ab43a7bd5731e
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/config/GlobalConfigManager.java
@@ -0,0 +1,239 @@
@@ -0,0 +1,232 @@
+package org.leavesmc.leaves.config;
+
+import org.jetbrains.annotations.Contract;
Expand Down Expand Up @@ -1826,16 +1819,9 @@ index 0000000000000000000000000000000000000000..191717863d411178405f19b9b66d1ece
+
+ private static void initCategory(@NotNull Field categoryField, @NotNull GlobalConfigCategory globalCategory, @Nullable Object upstreamField, @NotNull String upstreamPath) {
+ try {
+ Class<?> categoryClass = categoryField.getType();
+
+ Constructor<?> constructor = categoryClass.getDeclaredConstructor();
+ constructor.setAccessible(true);
+ Object category = constructor.newInstance();
+ categoryField.set(upstreamField, category);
+
+ Object category = categoryField.get(upstreamField);
+ String categoryPath = upstreamPath + globalCategory.value() + ".";
+
+ for (Field field : categoryClass.getDeclaredFields()) {
+ for (Field field : categoryField.getType().getDeclaredFields()) {
+ initField(field, category, categoryPath);
+ }
+ } catch (Exception e) {
Expand Down
Loading

0 comments on commit 8045636

Please sign in to comment.