Skip to content

Commit

Permalink
Fix #353
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Oct 5, 2024
1 parent 95e6661 commit 6c5cc79
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions patches/server/0010-Fakeplayer-support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -626,10 +626,10 @@ index 4632eb883e9f5efde520ee543bcad25827c0da2c..d710803137a325f34e0628405d5ddfd0
return event;
diff --git a/src/main/java/org/leavesmc/leaves/bot/BotCommand.java b/src/main/java/org/leavesmc/leaves/bot/BotCommand.java
new file mode 100644
index 0000000000000000000000000000000000000000..789ad3dd37baf80ac5597a37464cbbaceeb55d70
index 0000000000000000000000000000000000000000..527f01b206dcf0e677ac7ec8c27ebf5fbc27a190
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/bot/BotCommand.java
@@ -0,0 +1,543 @@
@@ -0,0 +1,544 @@
+package org.leavesmc.leaves.bot;
+
+import net.kyori.adventure.text.Component;
Expand Down Expand Up @@ -1014,19 +1014,20 @@ index 0000000000000000000000000000000000000000..789ad3dd37baf80ac5597a37464cbbac
+ System.arraycopy(args, 3, realArgs, 0, realArgs.length);
+ }
+
+ BotAction<?> newAction = null;
+ BotAction<?> newAction;
+ try {
+ if (action instanceof CraftCustomBotAction customBotAction) {
+ newAction = customBotAction.createCraft(player, realArgs);
+ } else {
+ newAction = action.create();
+ newAction.loadCommand(player.getHandle(), action.getArgument().parse(0, realArgs));
+ }
+ } catch (IllegalArgumentException ignore) {
+ } catch (IllegalArgumentException e) {
+ sender.sendMessage(text("Action create error, please check your arguments, " + e.getMessage(), NamedTextColor.RED));
+ return;
+ }
+
+ if (newAction == null) {
+ sender.sendMessage(text("Action create error, please check your arguments", NamedTextColor.RED));
+ return;
+ }
+
Expand Down

0 comments on commit 6c5cc79

Please sign in to comment.