From dd3af554954df223cf9a7643e24e7c7a7d4949c1 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Tue, 23 Sep 2025 16:21:47 +0800 Subject: [PATCH] Some format --- ...mand.patch => 0003-Leaves-Server-Config.patch} | 4 ++-- .../org/leavesmc/leaves/bot/agent/Actions.java | 2 +- .../bot/agent/actions/AbstractBotAction.java | 1 - .../bot/agent/actions/AbstractStateBotAction.java | 1 - .../bot/agent/actions/AbstractTimerBotAction.java | 8 ++------ .../bot/agent/actions/AbstractUseBotAction.java | 2 +- .../bot/agent/actions/ServerLookAction.java | 14 ++------------ .../bot/agent/actions/ServerMoveAction.java | 9 ++------- .../bot/agent/actions/ServerRotationAction.java | 2 +- .../org/leavesmc/leaves/command/CommandUtils.java | 6 +----- .../leaves/command/CustomArgumentType.java | 1 - .../leaves/command/bot/BotSubcommand.java | 1 - .../command/bot/subcommands/ConfigCommand.java | 7 ++----- .../command/bot/subcommands/CreateCommand.java | 6 +----- .../command/bot/subcommands/LoadCommand.java | 6 +----- .../command/bot/subcommands/RemoveCommand.java | 15 ++++++++++----- .../command/bot/subcommands/SaveCommand.java | 2 +- .../bot/subcommands/action/ListCommand.java | 5 +---- .../bot/subcommands/action/StartCommand.java | 5 +---- .../bot/subcommands/action/StopCommand.java | 2 +- .../leaves/command/leaves/LeavesCommand.java | 1 + .../leaves/subcommands/BlockUpdateCommand.java | 2 -- .../command/leaves/subcommands/ConfigCommand.java | 13 +++++-------- .../leaves/subcommands/CounterCommand.java | 5 ----- .../command/leaves/subcommands/ReloadCommand.java | 1 - .../litematics/ServuxLitematicsProtocol.java | 2 +- .../leavesmc/leaves/util/ShearsWrenchUtil.java | 2 -- 27 files changed, 37 insertions(+), 88 deletions(-) rename leaves-server/paper-patches/features/{0003-Leaves-Server-Config-And-Command.patch => 0003-Leaves-Server-Config.patch} (95%) diff --git a/leaves-server/paper-patches/features/0003-Leaves-Server-Config-And-Command.patch b/leaves-server/paper-patches/features/0003-Leaves-Server-Config.patch similarity index 95% rename from leaves-server/paper-patches/features/0003-Leaves-Server-Config-And-Command.patch rename to leaves-server/paper-patches/features/0003-Leaves-Server-Config.patch index 0bd858fc..6b05bd9e 100644 --- a/leaves-server/paper-patches/features/0003-Leaves-Server-Config-And-Command.patch +++ b/leaves-server/paper-patches/features/0003-Leaves-Server-Config.patch @@ -1,7 +1,7 @@ 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 +Subject: [PATCH] Leaves Server Config diff --git a/src/main/java/io/papermc/paper/SparksFly.java b/src/main/java/io/papermc/paper/SparksFly.java @@ -18,7 +18,7 @@ index 62e2d5704c348955bc8284dc2d54c933b7bcdd06..7ef20f0138fad39a1d23edd7b26ddc88 public void executeAsync(final Runnable runnable) { MCUtil.scheduleAsyncTask(this.catching(runnable, "asynchronous")); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 32fe51b19323e3c4c56e7f9e621e6e808ee5fe38..2eba1d900b20a781c4bb08caa2b30bfeb2d02b9d 100644 +index 1d12a870a2f239bf95df639ef350b38911558199..1e9a43814613b57483845cc4f66b9be4717b746f 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 { diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/Actions.java b/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/Actions.java index 7e0be5ea..214165eb 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/Actions.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/Actions.java @@ -16,7 +16,7 @@ public class Actions { private static final Map> actionsByName = new HashMap<>(); private static final Map, AbstractBotAction> actionsByClass = new HashMap<>(); - static { + static { register(new ServerAttackAction(), AttackAction.class); register(new ServerBreakBlockAction(), BreakBlockAction.class); register(new ServerDropAction(), DropAction.class); diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/AbstractBotAction.java b/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/AbstractBotAction.java index bf82942c..af98d6e4 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/AbstractBotAction.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/AbstractBotAction.java @@ -6,7 +6,6 @@ import net.minecraft.core.UUIDUtil; import net.minecraft.nbt.CompoundTag; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.leavesmc.leaves.LeavesLogger; import org.leavesmc.leaves.bot.ServerBot; import org.leavesmc.leaves.command.CommandContext; diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/AbstractStateBotAction.java b/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/AbstractStateBotAction.java index 6a6007fc..75876ab8 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/AbstractStateBotAction.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/AbstractStateBotAction.java @@ -3,7 +3,6 @@ package org.leavesmc.leaves.bot.agent.actions; import java.util.function.Supplier; public abstract class AbstractStateBotAction> extends AbstractBotAction { - public AbstractStateBotAction(String name, Supplier creator) { super(name, creator); this.setDoNumber(-1); diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/AbstractTimerBotAction.java b/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/AbstractTimerBotAction.java index 748398d2..632a08bf 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/AbstractTimerBotAction.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/AbstractTimerBotAction.java @@ -13,12 +13,8 @@ public abstract class AbstractTimerBotAction public AbstractTimerBotAction(String name, Supplier creator) { super(name, creator); - this.addArgument("delay", integer(0)) - .suggests(strings("0", "5", "10", "20")) - .setOptional(true); - this.addArgument("interval", integer(0)) - .suggests(strings("20", "0", "5", "10")) - .setOptional(true); + this.addArgument("delay", integer(0)).suggests(strings("0", "5", "10", "20")).setOptional(true); + this.addArgument("interval", integer(0)).suggests(strings("20", "0", "5", "10")).setOptional(true); this.addArgument("do_number", integer(-1)) .suggests(((context, builder) -> builder.suggest("-1", Component.literal("do infinite times")))) .setOptional(true); diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/AbstractUseBotAction.java b/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/AbstractUseBotAction.java index 4cf4c3f1..787cec99 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/AbstractUseBotAction.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/AbstractUseBotAction.java @@ -5,8 +5,8 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionResult; import org.jetbrains.annotations.NotNull; import org.leavesmc.leaves.bot.ServerBot; -import org.leavesmc.leaves.event.bot.BotActionStopEvent; import org.leavesmc.leaves.command.CommandContext; +import org.leavesmc.leaves.event.bot.BotActionStopEvent; import java.util.function.Supplier; diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/ServerLookAction.java b/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/ServerLookAction.java index 2aba85f8..a003bd51 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/ServerLookAction.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/ServerLookAction.java @@ -13,8 +13,8 @@ import net.minecraft.world.phys.Vec3; import org.bukkit.util.Vector; import org.jetbrains.annotations.NotNull; import org.leavesmc.leaves.bot.ServerBot; -import org.leavesmc.leaves.entity.bot.actions.CraftLookAction; import org.leavesmc.leaves.command.CommandContext; +import org.leavesmc.leaves.entity.bot.actions.CraftLookAction; public class ServerLookAction extends AbstractBotAction { @@ -25,17 +25,7 @@ public class ServerLookAction extends AbstractBotAction { public ServerLookAction() { super("look", ServerLookAction::new); - declarePlayerBranch(); - declareLocationBranch(); - } - - private void declarePlayerBranch() { - this.fork(0); - this.addArgument("player", EntityArgument.player()) - .setOptional(true); - } - - private void declareLocationBranch() { + this.addArgument("player", EntityArgument.player()).setOptional(true); this.fork(1); this.addArgument("location", Vec3Argument.vec3(false)); } diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/ServerMoveAction.java b/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/ServerMoveAction.java index b9a639d5..d7de3f57 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/ServerMoveAction.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/ServerMoveAction.java @@ -3,12 +3,11 @@ package org.leavesmc.leaves.bot.agent.actions; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.exceptions.CommandSyntaxException; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.leavesmc.leaves.bot.ServerBot; +import org.leavesmc.leaves.command.CommandContext; import org.leavesmc.leaves.entity.bot.action.MoveAction.MoveDirection; import org.leavesmc.leaves.entity.bot.actions.CraftMoveAction; import org.leavesmc.leaves.event.bot.BotActionStopEvent; -import org.leavesmc.leaves.command.CommandContext; import java.util.Arrays; import java.util.Map; @@ -26,11 +25,7 @@ public class ServerMoveAction extends AbstractStateBotAction { public ServerMoveAction() { super("move", ServerMoveAction::new); this.addArgument("direction", StringArgumentType.word()) - .suggests(strings( - Arrays.stream(MoveDirection.values()) - .map((it) -> it.name) - .toList() - )); + .suggests(strings(Arrays.stream(MoveDirection.values()).map((it) -> it.name).toList())); } @Override diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/ServerRotationAction.java b/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/ServerRotationAction.java index b7c6dbd0..55af45a1 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/ServerRotationAction.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/ServerRotationAction.java @@ -6,8 +6,8 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import org.jetbrains.annotations.NotNull; import org.leavesmc.leaves.bot.ServerBot; -import org.leavesmc.leaves.entity.bot.actions.CraftRotationAction; import org.leavesmc.leaves.command.CommandContext; +import org.leavesmc.leaves.entity.bot.actions.CraftRotationAction; import java.text.DecimalFormat; diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/command/CommandUtils.java b/leaves-server/src/main/java/org/leavesmc/leaves/command/CommandUtils.java index 8c518f74..a270312f 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/command/CommandUtils.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/command/CommandUtils.java @@ -40,10 +40,7 @@ public class CommandUtils { } @DefaultQualifier(NonNull.class) - public static @NotNull List getListClosestMatchingLast( - final String last, - final Collection collection - ) { + public static @NotNull List getListClosestMatchingLast(final String last, final Collection collection) { if (collection.isEmpty()) { return Collections.emptyList(); } @@ -132,7 +129,6 @@ public class CommandUtils { return H[s1Len + 1][s2Len + 1]; } - // Copy from org/bukkit/command/defaults/HelpCommand.java private record Candidate(String item, int score) { @Contract("_, _ -> new") private static @NotNull Candidate of(String item, int score) { diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/command/CustomArgumentType.java b/leaves-server/src/main/java/org/leavesmc/leaves/command/CustomArgumentType.java index 3e44ede1..86d3c5f6 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/command/CustomArgumentType.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/command/CustomArgumentType.java @@ -8,7 +8,6 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder; import java.util.concurrent.CompletableFuture; public interface CustomArgumentType { - ArgumentType getBaseArgumentType(); T transform(B value) throws CommandSyntaxException; diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/BotSubcommand.java b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/BotSubcommand.java index f6d215eb..0adae7a1 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/BotSubcommand.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/BotSubcommand.java @@ -5,7 +5,6 @@ import org.jetbrains.annotations.NotNull; import org.leavesmc.leaves.command.LiteralNode; public abstract class BotSubcommand extends LiteralNode { - protected BotSubcommand(String name) { super(name); } diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/ConfigCommand.java b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/ConfigCommand.java index b28f9cd4..10dc2e56 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/ConfigCommand.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/ConfigCommand.java @@ -42,9 +42,7 @@ public class ConfigCommand extends BotSubcommand { private BotArgument() { super("bot", new org.leavesmc.leaves.command.bot.BotArgument()); - Configs.getConfigs().stream() - .map(this::configNodeCreator) - .forEach(this::children); + Configs.getConfigs().stream().map(this::configNodeCreator).forEach(this::children); } @Contract(pure = true) @@ -93,8 +91,7 @@ public class ConfigCommand extends BotSubcommand { CommandContext ctx = new CommandContext(mojangCtx); return executeSet(ctx) ? 1 : 0; }); - return super.compileBase() - .then(argument); + return super.compileBase().then(argument); } @Override diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/CreateCommand.java b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/CreateCommand.java index 2812ff18..df406a58 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/CreateCommand.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/CreateCommand.java @@ -19,10 +19,10 @@ import org.jetbrains.annotations.NotNull; import org.leavesmc.leaves.LeavesConfig; import org.leavesmc.leaves.bot.BotCreateState; import org.leavesmc.leaves.bot.BotList; -import org.leavesmc.leaves.event.bot.BotCreateEvent; import org.leavesmc.leaves.command.ArgumentNode; import org.leavesmc.leaves.command.CommandContext; import org.leavesmc.leaves.command.bot.BotSubcommand; +import org.leavesmc.leaves.event.bot.BotCreateEvent; import static net.kyori.adventure.text.Component.text; import static net.minecraft.commands.arguments.DimensionArgument.getDimension; @@ -99,7 +99,6 @@ public class CreateCommand extends BotSubcommand { } private static class NameArgument extends ArgumentNode { - private NameArgument() { super("name", StringArgumentType.word()); children(SkinNameArgument::new); @@ -112,7 +111,6 @@ public class CreateCommand extends BotSubcommand { } private static class SkinNameArgument extends ArgumentNode { - private SkinNameArgument() { super("skin_name", StringArgumentType.word()); children(WorldArgument::new); @@ -125,7 +123,6 @@ public class CreateCommand extends BotSubcommand { } private static class WorldArgument extends ArgumentNode { - private WorldArgument() { super("world", DimensionArgument.dimension()); children(LocationArgument::new); @@ -138,7 +135,6 @@ public class CreateCommand extends BotSubcommand { } private static class LocationArgument extends ArgumentNode { - private LocationArgument() { super("location", Vec3Argument.vec3(true)); } diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/LoadCommand.java b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/LoadCommand.java index 2ef59a4b..699848f6 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/LoadCommand.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/LoadCommand.java @@ -55,11 +55,7 @@ public class LoadCommand extends BotSubcommand { sender.sendMessage(text("Failed to load bot, please check log", NamedTextColor.RED)); return false; } - sender.sendMessage(join( - spaces(), - text("Successfully loaded bot", NamedTextColor.GRAY), - asAdventure(bot.getDisplayName()) - )); + sender.sendMessage(join(spaces(), text("Successfully loaded bot", NamedTextColor.GRAY), asAdventure(bot.getDisplayName()))); return true; } diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/RemoveCommand.java b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/RemoveCommand.java index 0b154961..09df5362 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/RemoveCommand.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/RemoveCommand.java @@ -9,11 +9,11 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.leavesmc.leaves.bot.BotList; import org.leavesmc.leaves.bot.ServerBot; -import org.leavesmc.leaves.event.bot.BotRemoveEvent; import org.leavesmc.leaves.command.ArgumentNode; import org.leavesmc.leaves.command.CommandContext; import org.leavesmc.leaves.command.CustomArgumentNode; import org.leavesmc.leaves.command.bot.BotSubcommand; +import org.leavesmc.leaves.event.bot.BotRemoveEvent; import org.leavesmc.leaves.plugin.MinecraftInternalPlugin; import java.util.regex.Matcher; @@ -42,7 +42,6 @@ public class RemoveCommand extends BotSubcommand { } private static class BotArgument extends CustomArgumentNode { - private BotArgument() { super("bot", new org.leavesmc.leaves.command.bot.BotArgument()); children(RemoveTimeArgument::new); @@ -116,9 +115,15 @@ public class RemoveCommand extends BotSubcommand { foundMatch = true; int value = Integer.parseInt(matcher.group(1)); switch (matcher.group(2).toLowerCase()) { - case "h": seconds += value * 3600; break; - case "m": seconds += value * 60; break; - case "s": seconds += value; break; + case "h": + seconds += value * 3600; + break; + case "m": + seconds += value * 60; + break; + case "s": + seconds += value; + break; } } diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/SaveCommand.java b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/SaveCommand.java index 28b69dd8..218c06da 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/SaveCommand.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/SaveCommand.java @@ -8,10 +8,10 @@ import org.jetbrains.annotations.NotNull; import org.leavesmc.leaves.LeavesConfig; import org.leavesmc.leaves.bot.BotList; import org.leavesmc.leaves.bot.ServerBot; -import org.leavesmc.leaves.event.bot.BotRemoveEvent; import org.leavesmc.leaves.command.CommandContext; import org.leavesmc.leaves.command.CustomArgumentNode; import org.leavesmc.leaves.command.bot.BotSubcommand; +import org.leavesmc.leaves.event.bot.BotRemoveEvent; import static io.papermc.paper.adventure.PaperAdventure.asAdventure; import static net.kyori.adventure.text.Component.join; diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/action/ListCommand.java b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/action/ListCommand.java index 2d39b36c..1547891e 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/action/ListCommand.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/action/ListCommand.java @@ -36,10 +36,7 @@ public class ListCommand extends LiteralNode { return true; } - sender.sendMessage( - asAdventure(bot.getDisplayName()) - .append(text("'s action list:", GRAY)) - ); + sender.sendMessage(asAdventure(bot.getDisplayName()).append(text("'s action list:", GRAY))); for (int i = 0; i < actions.size(); i++) { AbstractBotAction action = actions.get(i); sender.sendMessage(join(spaces(), diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/action/StartCommand.java b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/action/StartCommand.java index 23159cba..8a7b0a18 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/action/StartCommand.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/action/StartCommand.java @@ -32,10 +32,7 @@ public class StartCommand extends LiteralNode { public StartCommand() { super("start"); - Actions.getAll() - .stream() - .map(this::actionNodeCreator) - .forEach(this::children); + Actions.getAll().stream().map(this::actionNodeCreator).forEach(this::children); } private boolean handleStartCommand(CommandContext context, @NotNull AbstractBotAction action) throws CommandSyntaxException { diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/action/StopCommand.java b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/action/StopCommand.java index d92493de..16d75583 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/action/StopCommand.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/action/StopCommand.java @@ -9,11 +9,11 @@ import org.bukkit.command.CommandSender; import org.jetbrains.annotations.NotNull; import org.leavesmc.leaves.bot.ServerBot; import org.leavesmc.leaves.bot.agent.actions.AbstractBotAction; -import org.leavesmc.leaves.event.bot.BotActionStopEvent; import org.leavesmc.leaves.command.ArgumentNode; import org.leavesmc.leaves.command.CommandContext; import org.leavesmc.leaves.command.LiteralNode; import org.leavesmc.leaves.command.bot.subcommands.ActionCommand; +import org.leavesmc.leaves.event.bot.BotActionStopEvent; import java.util.HashSet; import java.util.List; diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/LeavesCommand.java b/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/LeavesCommand.java index e3ee08b6..f30ec31d 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/LeavesCommand.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/LeavesCommand.java @@ -11,6 +11,7 @@ import org.leavesmc.leaves.command.leaves.subcommands.ReportCommand; import org.leavesmc.leaves.command.leaves.subcommands.UpdateCommand; public class LeavesCommand extends RootNode { + public static final LeavesCommand INSTANCE = new LeavesCommand(); private static final String PERM_BASE = "bukkit.command.leaves"; diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/subcommands/BlockUpdateCommand.java b/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/subcommands/BlockUpdateCommand.java index f9d5e841..9c91bb93 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/subcommands/BlockUpdateCommand.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/subcommands/BlockUpdateCommand.java @@ -46,7 +46,6 @@ public class BlockUpdateCommand extends LeavesSubcommand { } private class EnableNode extends LiteralNode { - private EnableNode() { super("enable"); } @@ -73,7 +72,6 @@ public class BlockUpdateCommand extends LeavesSubcommand { } private class DisableNode extends LiteralNode { - private DisableNode() { super("disable"); } diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/subcommands/ConfigCommand.java b/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/subcommands/ConfigCommand.java index 8dddd120..5d32cbc4 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/subcommands/ConfigCommand.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/subcommands/ConfigCommand.java @@ -6,11 +6,12 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder; import org.bukkit.Bukkit; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.leavesmc.leaves.config.GlobalConfigManager; -import org.leavesmc.leaves.config.VerifiedConfig; import org.leavesmc.leaves.command.ArgumentNode; import org.leavesmc.leaves.command.CommandContext; +import org.leavesmc.leaves.command.CommandUtils; import org.leavesmc.leaves.command.leaves.LeavesSubcommand; +import org.leavesmc.leaves.config.GlobalConfigManager; +import org.leavesmc.leaves.config.VerifiedConfig; import java.util.concurrent.CompletableFuture; @@ -18,7 +19,6 @@ import static net.kyori.adventure.text.Component.join; import static net.kyori.adventure.text.Component.text; import static net.kyori.adventure.text.JoinConfiguration.spaces; import static net.kyori.adventure.text.format.NamedTextColor.*; -import static org.leavesmc.leaves.command.CommandUtils.getListClosestMatchingLast; public class ConfigCommand extends LeavesSubcommand { @@ -39,10 +39,8 @@ public class ConfigCommand extends LeavesSubcommand { String path = context.getArgumentOrDefault(PathArgument.class, ""); int dotIndex = path.lastIndexOf("."); builder = builder.createOffset(builder.getInput().lastIndexOf(' ') + dotIndex + 2); - getListClosestMatchingLast( - path.substring(dotIndex + 1), - GlobalConfigManager.getVerifiedConfigSubPaths(path) - ).forEach(builder::suggest); + CommandUtils.getListClosestMatchingLast(path.substring(dotIndex + 1), GlobalConfigManager.getVerifiedConfigSubPaths(path)) + .forEach(builder::suggest); return builder.buildFuture(); } @@ -75,7 +73,6 @@ public class ConfigCommand extends LeavesSubcommand { } return verifiedConfig; } - } private static class ValueArgument extends ArgumentNode { diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/subcommands/CounterCommand.java b/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/subcommands/CounterCommand.java index d9e74f29..4329415d 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/subcommands/CounterCommand.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/subcommands/CounterCommand.java @@ -48,7 +48,6 @@ public class CounterCommand extends LeavesSubcommand { } private static class EnableNode extends LiteralNode { - private EnableNode() { super("enable"); } @@ -73,7 +72,6 @@ public class CounterCommand extends LeavesSubcommand { } private static class DisableNode extends LiteralNode { - private DisableNode() { super("disable"); } @@ -98,7 +96,6 @@ public class CounterCommand extends LeavesSubcommand { } private static class ResetAllNode extends LiteralNode { - private ResetAllNode() { super("reset"); } @@ -138,7 +135,6 @@ public class CounterCommand extends LeavesSubcommand { } private class ResetNode extends LiteralNode { - private ResetNode() { super("reset"); } @@ -155,7 +151,6 @@ public class CounterCommand extends LeavesSubcommand { } private class RealtimeNode extends LiteralNode { - private RealtimeNode() { super("realtime"); } diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/subcommands/ReloadCommand.java b/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/subcommands/ReloadCommand.java index 72be57c2..bf4d4428 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/subcommands/ReloadCommand.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/command/leaves/subcommands/ReloadCommand.java @@ -12,7 +12,6 @@ import static net.kyori.adventure.text.Component.text; import static net.kyori.adventure.text.format.NamedTextColor.GREEN; public class ReloadCommand extends LeavesSubcommand { - public ReloadCommand() { super("reload"); } diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/ServuxLitematicsProtocol.java b/leaves-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/ServuxLitematicsProtocol.java index 7f744bab..925a0e96 100755 --- a/leaves-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/ServuxLitematicsProtocol.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/ServuxLitematicsProtocol.java @@ -104,7 +104,7 @@ public class ServuxLitematicsProtocol implements LeavesProtocol { case PACKET_C2S_BLOCK_ENTITY_REQUEST -> onBlockEntityRequest(player, payload.getPos()); case PACKET_C2S_ENTITY_REQUEST -> onEntityRequest(player, payload.getEntityId()); - + case PACKET_C2S_BULK_ENTITY_NBT_REQUEST -> onBulkEntityRequest(player, payload.getChunkPos(), payload.getCompound()); case PACKET_C2S_NBT_RESPONSE_DATA -> { diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/util/ShearsWrenchUtil.java b/leaves-server/src/main/java/org/leavesmc/leaves/util/ShearsWrenchUtil.java index 07fb9a13..217d6ceb 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/util/ShearsWrenchUtil.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/util/ShearsWrenchUtil.java @@ -7,8 +7,6 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.*;