mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
70 lines
4.3 KiB
Diff
70 lines
4.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
Date: Sat, 1 Feb 2025 14:21:06 +0800
|
|
Subject: [PATCH] Leaves Server Config And Command
|
|
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/SparksFly.java b/src/main/java/io/papermc/paper/SparksFly.java
|
|
index 62e2d5704c348955bc8284dc2d54c933b7bcdd06..7ef20f0138fad39a1d23edd7b26ddc8816427ec8 100644
|
|
--- a/src/main/java/io/papermc/paper/SparksFly.java
|
|
+++ b/src/main/java/io/papermc/paper/SparksFly.java
|
|
@@ -42,7 +42,7 @@ public final class SparksFly {
|
|
this.mainThreadTaskQueue = new ConcurrentLinkedQueue<>();
|
|
this.logger = Logger.getLogger(ID);
|
|
this.logger.log(Level.INFO, "This server bundles the spark profiler. For more information please visit https://docs.papermc.io/paper/profiling");
|
|
- this.spark = PaperSparkModule.create(Compatibility.VERSION_1_0, server, this.logger, new PaperScheduler() {
|
|
+ this.spark = org.leavesmc.leaves.spark.LeavesSparkPlugin.create(Compatibility.VERSION_1_0, server, this.logger, new PaperScheduler() { // Leaves - make leaves
|
|
@Override
|
|
public void executeAsync(final Runnable runnable) {
|
|
MCUtil.scheduleAsyncTask(this.catching(runnable, "asynchronous"));
|
|
diff --git a/src/main/java/io/papermc/paper/command/brigadier/bukkit/BukkitCommandNode.java b/src/main/java/io/papermc/paper/command/brigadier/bukkit/BukkitCommandNode.java
|
|
index 1814cd072aaca3e72249f0509a9c3b3cb154eaba..11b394f479eb268b248fae8a72ea97886853d797 100644
|
|
--- a/src/main/java/io/papermc/paper/command/brigadier/bukkit/BukkitCommandNode.java
|
|
+++ b/src/main/java/io/papermc/paper/command/brigadier/bukkit/BukkitCommandNode.java
|
|
@@ -105,6 +105,14 @@ public class BukkitCommandNode extends LiteralCommandNode<CommandSourceStack> {
|
|
List<String> results = null;
|
|
Location pos = context.getSource().getLocation();
|
|
try {
|
|
+ // Leaves start - custom suggestion
|
|
+ if (this.command instanceof org.leavesmc.leaves.command.LeavesSuggestionCommand suggestionCommand) {
|
|
+ CompletableFuture<Suggestions> suggestions = suggestionCommand.tabSuggestion(sender, this.literal, args, pos.clone(), builder);
|
|
+ if (suggestions != null) {
|
|
+ return suggestions;
|
|
+ }
|
|
+ }
|
|
+ // Leaves end - custom suggestion
|
|
results = this.command.tabComplete(sender, this.literal, args, pos.clone());
|
|
} catch (CommandException ex) {
|
|
sender.sendMessage(ChatColor.RED + "An internal error occurred while attempting to tab-complete this command");
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index 1fb98caf0101fcbf3f045c0725c89fcbff4e7a7e..be8813cffb8bd5a5e573f9da63a6bd1a6f6d0bca 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -1117,6 +1117,7 @@ public final class CraftServer implements Server {
|
|
playerMetadata.removeAll(plugin);
|
|
}
|
|
// Paper end
|
|
+ org.leavesmc.leaves.LeavesConfig.reload(); // Leaves - Server Config
|
|
this.reloadData();
|
|
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
|
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
index c07481501358cd55c610cebd4891c804003795fa..b6a60aac952c1275da203215119d65934602c113 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
@@ -183,6 +183,14 @@ public class Main {
|
|
.defaultsTo("Unknown Server")
|
|
.describedAs("Name");
|
|
// Paper end
|
|
+
|
|
+ // Leaves start - Server Config
|
|
+ acceptsAll(asList("leaves", "leaves-settings"), "File for leaves settings")
|
|
+ .withRequiredArg()
|
|
+ .ofType(File.class)
|
|
+ .defaultsTo(new File("leaves.yml"))
|
|
+ .describedAs("Yml file");
|
|
+ // Leaves end - Server Config
|
|
}
|
|
};
|
|
|