mirror of
https://github.com/LeavesMC/Leaves.git
synced 2026-01-04 15:41:31 +00:00
69 lines
4.4 KiB
Diff
69 lines
4.4 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 5c52b1563d20d7e977a5bb958c18b19dec5c365a..65664441c5692620a8b22513ded497b7951a3245 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
|
|
@@ -106,6 +106,13 @@ 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) {
|
|
+ org.leavesmc.leaves.command.LeavesSuggestionBuilder suggestionBuilder = new org.leavesmc.leaves.command.LeavesSuggestionBuilder(builder.createOffset(builder.getInput().lastIndexOf(' ') + 1));
|
|
+ suggestionCommand.suggest(sender, this.literal, args, pos.clone(), suggestionBuilder);
|
|
+ return suggestionBuilder.build();
|
|
+ }
|
|
+ // Leaves end - custom suggestion
|
|
results = this.command.tabComplete(sender, this.literal, args, pos.clone());
|
|
} catch (CommandException ex) {
|
|
sender.sendMessage(Component.text("An internal error occurred while attempting to tab-complete this command", NamedTextColor.RED));
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index 32fe51b19323e3c4c56e7f9e621e6e808ee5fe38..2eba1d900b20a781c4bb08caa2b30bfeb2d02b9d 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -1076,6 +1076,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 a950bfb0c6aeb0b19150c59cea13337005c2752a..7f68edab68fc82a7ae269f01633c786b2d1026a8 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
@@ -169,6 +169,14 @@ public class Main {
|
|
.ofType(String.class)
|
|
.defaultsTo("Unknown Server")
|
|
.describedAs("Name");
|
|
+
|
|
+ // 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
|
|
}
|
|
};
|
|
|