9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-27 02:49:19 +00:00

Leaf 1.21.4

WIP
This commit is contained in:
Dreeam
2025-01-17 19:54:25 -05:00
parent e25f393ebf
commit ed1cdcd19d
485 changed files with 29906 additions and 30502 deletions

View File

@@ -0,0 +1,138 @@
--- a/gale-api/build.gradle.kts
+++ b/gale-api/build.gradle.kts
@@ -12,8 +_,10 @@
val annotationsVersion = "26.0.1"
val bungeeCordChatVersion = "1.20-R0.2"
val adventureVersion = "4.18.0"
-val slf4jVersion = "2.0.9"
-val log4jVersion = "2.17.1"
+// Leaf start - Bump Dependencies
+val slf4jVersion = "2.0.16"
+val log4jVersion = "2.24.3"
+// Leaf end - Bump Dependencies
val apiAndDocs: Configuration by configurations.creating {
attributes {
@@ -41,9 +_,9 @@
dependencies {
// api dependencies are listed transitively to API consumers
- api("com.google.guava:guava:33.3.1-jre")
+ api("com.google.guava:guava:33.4.0-jre") // Leaf - Bump Dependencies
api("com.google.code.gson:gson:2.11.0")
- api("org.yaml:snakeyaml:2.2")
+ api("org.yaml:snakeyaml:2.3") // Leaf - Bump Dependencies
api("org.joml:joml:1.10.8") {
isTransitive = false // https://github.com/JOML-CI/JOML/issues/352
}
@@ -54,6 +_,7 @@
api("org.apache.logging.log4j:log4j-api:$log4jVersion")
api("org.slf4j:slf4j-api:$slf4jVersion")
api("com.mojang:brigadier:1.3.10")
+ api("io.sentry:sentry:8.0.0-rc.3") // Pufferfish
// Deprecate bungeecord-chat in favor of adventure
api("net.md-5:bungeecord-chat:$bungeeCordChatVersion-deprecated+build.19") {
@@ -68,29 +_,37 @@
apiAndDocs("net.kyori:adventure-text-serializer-plain")
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
- api("org.apache.maven:maven-resolver-provider:3.9.6") // make API dependency for Paper Plugins
- compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
- compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
+ // Leaf start - Bump Dependencies
+ api("org.apache.maven:maven-resolver-provider:3.9.9") // make API dependency for Paper Plugins
+ compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.22") // Dreeam TODO - Update to 2.0.1
+ compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.22") // Dreeam TODO - Update to 2.0.1
+ // Leaf start - Bump Dependencies
// Annotations - Slowly migrate to jspecify
val annotations = "org.jetbrains:annotations:$annotationsVersion"
compileOnly(annotations)
testCompileOnly(annotations)
- val checkerQual = "org.checkerframework:checker-qual:3.33.0"
+ val checkerQual = "org.checkerframework:checker-qual:3.48.4" // Leaf - Bump Dependencies
compileOnlyApi(checkerQual)
testCompileOnly(checkerQual)
api("org.jspecify:jspecify:1.0.0")
// Test dependencies
- testImplementation("org.apache.commons:commons-lang3:3.12.0")
- testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
- testImplementation("org.hamcrest:hamcrest:2.2")
- testImplementation("org.mockito:mockito-core:5.14.1")
+ // Leaf start - Bump Dependencies
+ testImplementation("org.apache.commons:commons-lang3:3.17.0")
+ testImplementation("org.junit.jupiter:junit-jupiter:5.11.4")
+ testImplementation("org.hamcrest:hamcrest:3.0")
+ testImplementation("org.mockito:mockito-core:5.15.2")
testImplementation("org.ow2.asm:asm-tree:9.7.1")
- mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // configure mockito agent that is needed in newer java versions
+ mockitoAgent("org.mockito:mockito-core:5.15.2") { isTransitive = false } // configure mockito agent that is needed in newer java versions
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
+
+ // commons-lang3 is removed in maven-resolver-provider since 3.9.8
+ // Add this because bukkit api still need it.
+ compileOnly("org.apache.commons:commons-lang3:3.17.0")
+ // Leaf end - Bump Dependencies
}
val generatedApiPath: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath() // Gale - project setup
@@ -105,17 +_,21 @@
srcDir(generatedApiPath)
// Gale start - project setup
srcDir(file("../paper-api/src/main/java"))
+ srcDir(file("../gale-api/src/main/java")) // Leaf - project setup
}
resources {
srcDir(file("../paper-api/src/main/resources"))
+ srcDir(file("../gale-api/src/main/resources")) // Leaf - project setup
}
}
test {
java {
srcDir(file("../paper-api/src/test/java"))
+ srcDir(file("../gale-api/src/test/java")) // Leaf - project setup
}
resources {
srcDir(file("../paper-api/src/test/resources"))
+ srcDir(file("../gale-api/src/test/resources")) // Leaf - project setup
// Gale end - project setup
}
}
@@ -203,8 +_,8 @@
options.use()
options.isDocFilesSubDirs = true
options.links(
- "https://guava.dev/releases/33.3.1-jre/api/docs/",
- "https://javadoc.io/doc/org.yaml/snakeyaml/2.2/",
+ "https://guava.dev/releases/33.4.0-jre/api/docs/", // Leaf - Bump Dependencies
+ "https://javadoc.io/doc/org.yaml/snakeyaml/2.3/", // Leaf - Bump Dependencies
"https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/",
"https://javadoc.io/doc/org.joml/joml/1.10.8/",
"https://www.javadoc.io/doc/com.google.code.gson/gson/2.11.0",
@@ -217,8 +_,8 @@
"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.maven.resolver/maven-resolver-api/1.7.3",
+ "https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/2.20.0/", // Leaf - Bump Dependencies
+ "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.9.22", // Leaf - Bump Dependencies
)
options.tags("apiNote:a:API Note:")
@@ -276,6 +_,11 @@
jarToScan.set(tasks.jar.flatMap { it.archiveFile })
classpath.from(configurations.compileClasspath)
}
+// Leaf start - Bump Dependencies
+repositories {
+ mavenCentral()
+}
+// Leaf end - Bump Dependencies
tasks.check {
dependsOn(scanJarForOldGeneratedCode)
}

View File

@@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Tue, 21 May 2024 11:43:49 +0800
Subject: [PATCH] Rebrand
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfo.java b/src/main/java/io/papermc/paper/ServerBuildInfo.java
index b68770f6992b044d13e67d9affa6933c90ca8fb8..184ed5a41a138d14757f12acd4ec3113cb165b72 100644
--- a/src/main/java/io/papermc/paper/ServerBuildInfo.java
+++ b/src/main/java/io/papermc/paper/ServerBuildInfo.java
@@ -26,6 +26,17 @@ public interface ServerBuildInfo {
Key BRAND_GALE_ID = Key.key("galemc", "gale");
// Gale end - branding changes
+ // Leaf start
+ /**
+ * The brand id for Pufferfish.
+ */
+ Key BRAND_PUFFERFISH_ID = Key.key("pufferfish", "pufferfish");
+ /**
+ * The brand id for Leaf.
+ */
+ Key BRAND_LEAF_ID = Key.key("winds-studio", "leaf");
+ // Leaf end
+
/**
* Gets the {@code ServerBuildInfo}.
*
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
index e64bb57f74e6d6f78927be228825b3e0bdf41f48..5bccca7740dbec750960d96d4d951cff5da688da 100644
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
@@ -215,7 +215,7 @@ public class VersionCommand extends BukkitCommand {
String version = Bukkit.getVersion();
// Paper start
if (version.startsWith("null")) { // running from ide?
- setVersionMessage(Component.text("Unknown version, custom build?", NamedTextColor.YELLOW));
+ setVersionMessage(Component.text("* Unknown version, custom build?", NamedTextColor.RED)); // Leaf - Purpur - Clean up version command output
return;
}
setVersionMessage(getVersionFetcher().getVersionMessage(version));

View File

@@ -0,0 +1,25 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Thu, 11 Aug 2022 04:13:27 +0800
Subject: [PATCH] Leaf config files
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 2dccd3f72e188a34c9cdf80816aadb0c79351279..331006b854dfe785c567baf8489afaac01a99cd0 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2383,6 +2383,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
// Paper end
+ // Leaf start
+ @NotNull
+ public org.bukkit.configuration.file.YamlConfiguration getLeafConfig()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ // Leaf end
+
/**
* Sends the component to the player
*

View File

@@ -0,0 +1,233 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kevin Raneri <kevin.raneri@gmail.com>
Date: Tue, 9 Nov 2021 14:01:56 -0500
Subject: [PATCH] Pufferfish: Sentry
Original license: GPL v3
Original project: https://github.com/pufferfish-gg/Pufferfish
diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java
new file mode 100644
index 0000000000000000000000000000000000000000..c7772aac00f6db664f7a5673bc2585fa025e6aad
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java
@@ -0,0 +1,165 @@
+package gg.pufferfish.pufferfish.sentry;
+
+import com.google.gson.Gson;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.logging.log4j.ThreadContext;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Event;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.RegisteredListener;
+import org.jetbrains.annotations.Nullable;
+
+public class SentryContext {
+
+ private static final Gson GSON = new Gson();
+
+ public static void setPluginContext(@Nullable Plugin plugin) {
+ if (plugin != null) {
+ ThreadContext.put("pufferfishsentry_pluginname", plugin.getName());
+ ThreadContext.put("pufferfishsentry_pluginversion", plugin.getPluginMeta().getVersion());
+ }
+ }
+
+ public static void removePluginContext() {
+ ThreadContext.remove("pufferfishsentry_pluginname");
+ ThreadContext.remove("pufferfishsentry_pluginversion");
+ }
+
+ public static void setSenderContext(@Nullable CommandSender sender) {
+ if (sender != null) {
+ ThreadContext.put("pufferfishsentry_playername", sender.getName());
+ if (sender instanceof Player player) {
+ ThreadContext.put("pufferfishsentry_playerid", player.getUniqueId().toString());
+ }
+ }
+ }
+
+ public static void removeSenderContext() {
+ ThreadContext.remove("pufferfishsentry_playername");
+ ThreadContext.remove("pufferfishsentry_playerid");
+ }
+
+ public static void setEventContext(Event event, RegisteredListener registration) {
+ setPluginContext(registration.getPlugin());
+
+ try {
+ // Find the player that was involved with this event
+ Player player = null;
+ if (event instanceof PlayerEvent) {
+ player = ((PlayerEvent) event).getPlayer();
+ } else {
+ Class<? extends Event> eventClass = event.getClass();
+
+ Field playerField = null;
+
+ for (Field field : eventClass.getDeclaredFields()) {
+ if (field.getType().equals(Player.class)) {
+ playerField = field;
+ break;
+ }
+ }
+
+ if (playerField != null) {
+ playerField.setAccessible(true);
+ player = (Player) playerField.get(event);
+ }
+ }
+
+ if (player != null) {
+ setSenderContext(player);
+ }
+ } catch (Exception ignored) {
+ } // We can't really safely log exceptions.
+
+ ThreadContext.put("pufferfishsentry_eventdata", GSON.toJson(serializeFields(event)));
+ }
+
+ public static void removeEventContext() {
+ removePluginContext();
+ removeSenderContext();
+ ThreadContext.remove("pufferfishsentry_eventdata");
+ }
+
+ private static Map<String, String> serializeFields(Object object) {
+ Map<String, String> fields = new TreeMap<>();
+ fields.put("_class", object.getClass().getName());
+ for (Field declaredField : object.getClass().getDeclaredFields()) {
+ try {
+ if (Modifier.isStatic(declaredField.getModifiers())) {
+ continue;
+ }
+
+ String fieldName = declaredField.getName();
+ if (fieldName.equals("handlers")) {
+ continue;
+ }
+ declaredField.setAccessible(true);
+ Object value = declaredField.get(object);
+ if (value != null) {
+ fields.put(fieldName, value.toString());
+ } else {
+ fields.put(fieldName, "<null>");
+ }
+ } catch (Exception ignored) {
+ } // We can't really safely log exceptions.
+ }
+ return fields;
+ }
+
+ public static class State {
+
+ private Plugin plugin;
+ private Command command;
+ private String commandLine;
+ private Event event;
+ private RegisteredListener registeredListener;
+
+ public Plugin getPlugin() {
+ return plugin;
+ }
+
+ public void setPlugin(Plugin plugin) {
+ this.plugin = plugin;
+ }
+
+ public Command getCommand() {
+ return command;
+ }
+
+ public void setCommand(Command command) {
+ this.command = command;
+ }
+
+ public String getCommandLine() {
+ return commandLine;
+ }
+
+ public void setCommandLine(String commandLine) {
+ this.commandLine = commandLine;
+ }
+
+ public Event getEvent() {
+ return event;
+ }
+
+ public void setEvent(Event event) {
+ this.event = event;
+ }
+
+ public RegisteredListener getRegisteredListener() {
+ return registeredListener;
+ }
+
+ public void setRegisteredListener(RegisteredListener registeredListener) {
+ this.registeredListener = registeredListener;
+ }
+ }
+}
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 001465eedafa51ac027a4db51cba6223edfe1171..2e6d62c4f3687e299c34e876c503b400e13be05a 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -597,7 +597,9 @@ public final class SimplePluginManager implements PluginManager {
// Paper start
private void handlePluginException(String msg, Throwable ex, Plugin plugin) {
+ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish
server.getLogger().log(Level.SEVERE, msg, ex);
+ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerPluginEnableDisableException(msg, ex, plugin)));
}
// Paper end
@@ -667,9 +669,11 @@ public final class SimplePluginManager implements PluginManager {
));
}
} catch (Throwable ex) {
+ gg.pufferfish.pufferfish.sentry.SentryContext.setEventContext(event, registration); // Pufferfish
// Paper start - error reporting
String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName();
server.getLogger().log(Level.SEVERE, msg, ex);
+ gg.pufferfish.pufferfish.sentry.SentryContext.removeEventContext(); // Pufferfish
if (!(event instanceof com.destroystokyo.paper.event.server.ServerExceptionEvent)) { // We don't want to cause an endless event loop
callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event)));
}
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index 8acf45815b5841e3b2082a8bc5b7974e85cdd7f9..2fae50a9d1f0d9ecd91036697dedd64bc56f7d3b 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -343,7 +343,13 @@ public final class JavaPluginLoader implements PluginLoader {
try {
jPlugin.setEnabled(true);
} catch (Throwable ex) {
+ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish
server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
+ // Paper start - Disable plugins that fail to load
+ this.server.getPluginManager().disablePlugin(jPlugin);
+ return;
+ // Paper end
}
// Perhaps abort here, rather than continue going, but as it stands,
@@ -368,7 +374,9 @@ public final class JavaPluginLoader implements PluginLoader {
try {
jPlugin.setEnabled(false);
} catch (Throwable ex) {
+ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish
server.getLogger().log(Level.SEVERE, "Error occurred while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
}
if (cloader instanceof PluginClassLoader) {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Github Actions <no-reply@github.com>
Date: Thu, 16 Jan 2025 11:21:11 +0000
Subject: [PATCH] Purpur generated-api Changes
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
Commit: dd4143984219cea8440913b7918322b5ba59265a
diff --git a/src/generated/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/generated/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index f15a7b4471cd31a487467ec7ecf7a186fa887a51..f09fefe6821d8b2b8c8f055985bacc2e042ca569 100644
--- a/src/generated/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/src/generated/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -441,6 +441,26 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class);
+ // Purpur start - Ridables
+ GoalKey<Mob> MOB_HAS_RIDER = GoalKey.of(Mob.class, NamespacedKey.minecraft("has_rider"));
+ GoalKey<AbstractHorse> HORSE_HAS_RIDER = GoalKey.of(AbstractHorse.class, NamespacedKey.minecraft("horse_has_rider"));
+ GoalKey<Llama> LLAMA_HAS_RIDER = GoalKey.of(Llama.class, NamespacedKey.minecraft("llama_has_rider"));
+ // Purpur end - Ridables
+ // Purpur start - Phantoms attracted to crystals and crystals shoot phantoms
+ GoalKey<Phantom> FIND_CRYSTAL = GoalKey.of(Phantom.class, NamespacedKey.minecraft("find_crystal"));
+ GoalKey<Phantom> ORBIT_CRYSTAL = GoalKey.of(Phantom.class, NamespacedKey.minecraft("orbit_crystal"));
+ // Purpur end - Phantoms attracted to crystals and crystals shoot phantoms
+ // Purpur start - Add option to disable zombie aggressiveness towards villagers when lagging
+ GoalKey<Drowned> DROWNED_ATTACK_VILLAGER = GoalKey.of(Drowned.class, NamespacedKey.minecraft("drowned_attack_villager"));
+ GoalKey<Zombie> ZOMBIE_ATTACK_VILLAGER = GoalKey.of(Zombie.class, NamespacedKey.minecraft("zombie_attack_villager"));
+ // Purpur end - Add option to disable zombie aggressiveness towards villagers when lagging
+ // Purpur start - Configurable chance for wolves to spawn rabid
+ GoalKey<Wolf> AVOID_RABID_WOLF = GoalKey.of(Wolf.class, NamespacedKey.minecraft("avoid_rabid_wolf"));
+ // Purpur end - Configurable chance for wolves to spawn rabid
+ // Purpur start - Iron golem poppy calms anger
+ GoalKey<IronGolem> RECEIVE_FLOWER = GoalKey.of(IronGolem.class, NamespacedKey.minecraft("receive_flower"));
+ // Purpur end - Iron golem poppy calms anger
+
private static <T extends Mob> GoalKey<T> create(final String key, final Class<T> type) {
return GoalKey.of(type, NamespacedKey.minecraft(key));
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: nostalgic853 <yuu8583@proton.me>
Date: Sun, 20 Nov 2022 00:20:01 +0800
Subject: [PATCH] KeYi: Player Skull API
Original license: MIT
Original project: https://github.com/KeYiMC/KeYi
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 886a954b1a12e895f5d54fd35a9acb36673e3733..02cf7995d15487a4958ba5a5a19018d24d707b80 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -4021,4 +4021,23 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
sendDeathScreen(message);
}
// Purpur end
+
+ // Leaf start - KeYi - Player Skull API
+ /**
+ * Get a skull item of a player.
+ * This method runs on main thread, which may freeze the server.
+ *
+ * @return A skull ItemStack of the player
+ */
+ ItemStack getSkull();
+
+ /**
+ * Get a skull item of a player.
+ * This method runs on main thread, which may freeze the server.
+ *
+ * @return A CompletableFuture of the skull ItemStack of the player
+ */
+ @Deprecated(forRemoval = true)
+ CompletableFuture<ItemStack> getSkullAsynchronously();
+ // Leaf end - KeYi
}

View File

@@ -0,0 +1,48 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Sat, 13 Aug 2022 08:58:21 -0500
Subject: [PATCH] Slice: Smooth Teleports
Original license: MIT
Original project: https://github.com/Cryptite/Slice
Co-authored-by: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 02cf7995d15487a4958ba5a5a19018d24d707b80..31fcd0512b8b9ad2a36d8338c581972a450cda7c 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3732,6 +3732,33 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
String getClientBrandName();
// Paper end
+ /**
+ * This abuses some of how Minecraft works and attempts to teleport a player to another world without
+ * triggering typical respawn packets. All of natural state of chunk resends, entity adds/removes, etc still
+ * happen but the visual "refresh" of a world change is hidden. Depending on the destination location/world,
+ * this can act as a "smooth teleport" to a world if the new world is very similar looking to the old one.
+ *
+ * @param location New location to teleport this Player to
+ * @deprecated use {@link #teleportWithoutRespawnOptionally(Location)}
+ */
+ // Slice start
+ @org.jetbrains.annotations.ApiStatus.Experimental
+ @Deprecated(since = "1.21.1", forRemoval = true)
+ void teleportWithoutRespawn(@NotNull Location location);
+
+ /**
+ * This abuses some of how Minecraft works and attempts to teleport a player to another world without
+ * triggering typical respawn packets. All of natural state of chunk resends, entity adds/removes, etc still
+ * happen but the visual "refresh" of a world change is hidden. Depending on the destination location/world,
+ * this can act as a "smooth teleport" to a world if the new world is very similar looking to the old one.
+ *
+ * @param location New location to teleport this Player to
+ * @return Whether the teleport was successful
+ */
+ @org.jetbrains.annotations.ApiStatus.Experimental
+ boolean teleportWithoutRespawnOptionally(@NotNull Location location);
+ // Slice end
+
// Paper start - Teleport API
/**
* Sets the player's rotation.

View File

@@ -0,0 +1,78 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Sat, 3 Feb 2024 18:45:53 -0500
Subject: [PATCH] Configurable LibraryLoader maven repos
TODO - Dreeam: Support multi maven repos for lib downloading.
Add JVM flag `-DLeaf.library-download-repo=link` to choose library download repo link.
e.g. `-DLeaf.library-download-repo=https://maven.aliyun.com/repository/public`
diff --git a/src/main/java/io/papermc/paper/plugin/loader/library/impl/MavenLibraryResolver.java b/src/main/java/io/papermc/paper/plugin/loader/library/impl/MavenLibraryResolver.java
index 107705db2d82b7c191e5e625ec888e0bc3b03831..81d7b0d1a9f5e1f6e55e0d6a61ce1433825ef414 100644
--- a/src/main/java/io/papermc/paper/plugin/loader/library/impl/MavenLibraryResolver.java
+++ b/src/main/java/io/papermc/paper/plugin/loader/library/impl/MavenLibraryResolver.java
@@ -105,7 +105,7 @@ public class MavenLibraryResolver implements ClassPathLibrary {
* dependencies from
*/
public void addRepository(final RemoteRepository remoteRepository) {
- this.repositories.add(remoteRepository);
+ this.repositories.add(org.dreeam.leaf.plugin.loader.MavenCentralMirror.getCentralRepo(remoteRepository)); // Leaf - Configurable maven repos
}
/**
diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
index 211c093ce2253e918cd40725ebf1ef172d1b9bdf..5acd7cd09e9bdc26de443d166b193e163aae0188 100644
--- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
@@ -79,7 +79,19 @@ public class LibraryLoader
session.setSystemProperties( System.getProperties() );
session.setReadOnly();
- this.repositories = repository.newResolutionRepositories( session, Arrays.asList( new RemoteRepository.Builder( "central", "default", "https://repo.maven.apache.org/maven2" ).build() ) );
+ // Leaf start - Configurable maven repos
+ this.repositories = repository.newResolutionRepositories(
+ session,
+ List.of(org.dreeam.leaf.plugin.loader.MavenCentralMirror.getCentralRepo("https://repo.maven.apache.org/maven2"))
+ );
+ /* // Dreeam TODO
+ this.repositories = repository.newResolutionRepositories(session, List.of(
+ new RemoteRepository.Builder("central", "default", "https://repo.maven.apache.org/maven2").build(),
+ new RemoteRepository.Builder("aliyun", "default", "https://maven.aliyun.com/repository/public").build(),
+ new RemoteRepository.Builder("tencentclound", "default", "https://mirrors.cloud.tencent.com/nexus/repository/maven-public/").build(),
+ new RemoteRepository.Builder("huaweicloud", "default", "https://repo.huaweicloud.com/repository/maven/").build()
+ ));*/
+ // Leaf end - Configurable maven repos
}
@Nullable
diff --git a/src/main/java/org/dreeam/leaf/plugin/loader/MavenCentralMirror.java b/src/main/java/org/dreeam/leaf/plugin/loader/MavenCentralMirror.java
new file mode 100644
index 0000000000000000000000000000000000000000..95534cb6d771a0fe288e7c843c41b0036bdc7095
--- /dev/null
+++ b/src/main/java/org/dreeam/leaf/plugin/loader/MavenCentralMirror.java
@@ -0,0 +1,24 @@
+package org.dreeam.leaf.plugin.loader;
+
+import org.eclipse.aether.repository.RemoteRepository;
+
+public class MavenCentralMirror {
+
+ public static final String MAVEN_CENTRAL_MIRROR_REPO = System.getProperty("Leaf.library-download-repo");
+
+ public static RemoteRepository getCentralRepo(RemoteRepository repo) {
+ if (MAVEN_CENTRAL_MIRROR_REPO != null && repo.getUrl().contains("repo.maven.apache.org/maven2")) {
+ repo = new RemoteRepository.Builder("central", "default", MAVEN_CENTRAL_MIRROR_REPO).build();
+ }
+
+ return repo;
+ }
+
+ public static RemoteRepository getCentralRepo(String repo) {
+ if (MAVEN_CENTRAL_MIRROR_REPO != null) {
+ repo = MAVEN_CENTRAL_MIRROR_REPO;
+ }
+
+ return new RemoteRepository.Builder("central", "default", repo).build();
+ }
+}

View File

@@ -0,0 +1,154 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Thu, 3 Aug 2023 20:36:38 +0800
Subject: [PATCH] Leaves: Replay Mod API
Co-authored-by: alazeprt <nono135246@126.com>
Original license: GPLv3
Original project: https://github.com/LeavesMC/Leaves
This patch is Powered by ReplayMod(https://github.com/ReplayMod)
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 196109f427fb1169785b82b4cfb52c53329d2bea..3e999a4805fbf733dc1530e7dbf23aa10642cb39 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -3048,6 +3048,7 @@ public final class Bukkit {
return server.spigot();
}
+
// Purpur start - Bring back server name
/**
* Get the name of this server
@@ -3176,4 +3177,10 @@ public final class Bukkit {
server.clearBlockHighlights();
}
// Purpur end - Debug Marker API
+
+ // Leaves start - Photographer API
+ public static @NotNull org.leavesmc.leaves.entity.PhotographerManager getPhotographerManager() {
+ return server.getPhotographerManager();
+ }
+ // Leaves end - Photographer API
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 335db5f0893df51c65c5aab7f11fd6aef59a191d..78ddb4f8e90d797920ed7664055ba81d3c7cde41 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;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.leavesmc.leaves.entity.PhotographerManager;
/**
* Represents a server implementation.
@@ -2859,4 +2860,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
void clearBlockHighlights();
// Purpur end - Debug Marker API
+
+ // Leaves start - Photographer API
+ @NotNull PhotographerManager getPhotographerManager();
+ // Leaves end - Photographer API
}
diff --git a/src/main/java/org/leavesmc/leaves/entity/Photographer.java b/src/main/java/org/leavesmc/leaves/entity/Photographer.java
new file mode 100644
index 0000000000000000000000000000000000000000..5b564dfd8aa882d0dc8b1833a4b46e1bba699876
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/entity/Photographer.java
@@ -0,0 +1,27 @@
+package org.leavesmc.leaves.entity;
+
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.File;
+
+public interface Photographer extends Player {
+
+ @NotNull
+ public String getId();
+
+ public void setRecordFile(@NotNull File file);
+
+ public void stopRecording();
+
+ public void stopRecording(boolean async);
+
+ public void stopRecording(boolean async, boolean save);
+
+ public void pauseRecording();
+
+ public void resumeRecording();
+
+ public void setFollowPlayer(@Nullable Player player);
+}
\ No newline at end of file
diff --git a/src/main/java/org/leavesmc/leaves/entity/PhotographerManager.java b/src/main/java/org/leavesmc/leaves/entity/PhotographerManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..ccb19e75748803eb9ad356ffcd0ccfd5145ed776
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/entity/PhotographerManager.java
@@ -0,0 +1,32 @@
+package org.leavesmc.leaves.entity;
+
+import org.bukkit.Location;
+import org.bukkit.util.Consumer;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.leavesmc.leaves.replay.BukkitRecorderOption;
+
+import java.util.Collection;
+import java.util.UUID;
+
+public interface PhotographerManager {
+ @Nullable
+ public Photographer getPhotographer(@NotNull UUID uuid);
+
+ @Nullable
+ public Photographer getPhotographer(@NotNull String id);
+
+ @Nullable
+ public Photographer createPhotographer(@NotNull String id, @NotNull Location location);
+
+ @Nullable
+ public Photographer createPhotographer(@NotNull String id, @NotNull Location location, @NotNull BukkitRecorderOption recorderOption);
+
+ public void removePhotographer(@NotNull String id);
+
+ public void removePhotographer(@NotNull UUID uuid);
+
+ public void removeAllPhotographers();
+
+ public Collection<Photographer> getPhotographers();
+}
\ No newline at end of file
diff --git a/src/main/java/org/leavesmc/leaves/replay/BukkitRecorderOption.java b/src/main/java/org/leavesmc/leaves/replay/BukkitRecorderOption.java
new file mode 100644
index 0000000000000000000000000000000000000000..c985721bdf6be0b8a154e7abfd50e0168965a8d1
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/replay/BukkitRecorderOption.java
@@ -0,0 +1,18 @@
+package org.leavesmc.leaves.replay;
+
+public class BukkitRecorderOption {
+
+ // public int recordDistance = -1;
+ public String serverName = "Leaf";
+ public BukkitRecordWeather forceWeather = BukkitRecordWeather.NULL;
+ public int forceDayTime = -1;
+ public boolean ignoreChat = false;
+ // public boolean ignoreItem = false;
+
+ public enum BukkitRecordWeather {
+ CLEAR,
+ RAIN,
+ THUNDER,
+ NULL
+ }
+}
\ No newline at end of file