fix: some fix for bot action
fix stop command could stop all the same type of action when a stop action called fix some typo in command reply
This commit is contained in:
+5
-3
@@ -56,11 +56,13 @@ public class StartCommand extends LiteralNode {
|
||||
ServerBot bot = getBot(context);
|
||||
CommandSender sender = context.getSender();
|
||||
|
||||
action.loadCommand(context);
|
||||
if (bot.addBotAction(action, sender)) {
|
||||
// Create a new instance of the action to avoid sharing state between multiple actions
|
||||
AbstractBotAction<?> newAction = action.create();
|
||||
newAction.loadCommand(context);
|
||||
if (bot.addBotAction(newAction, sender)) {
|
||||
sender.sendMessage(join(spaces(),
|
||||
text("Action", GRAY),
|
||||
text(action.getName(), AQUA).hoverEvent(showText(text(action.getActionDataString()))),
|
||||
text(newAction.getName(), AQUA).hoverEvent(showText(text(newAction.getActionDataString()))),
|
||||
text("has been issued to", GRAY),
|
||||
asAdventure(bot.getDisplayName())
|
||||
));
|
||||
|
||||
+2
-2
@@ -141,13 +141,13 @@ public class StopCommand extends LiteralNode {
|
||||
if (canceled.isEmpty()) {
|
||||
sender.sendMessage(join(spaces(),
|
||||
asAdventure(bot.getDisplayName()).append(text("'s", GRAY)),
|
||||
text("'s action list cleared", GRAY)
|
||||
text("action list cleared", GRAY)
|
||||
));
|
||||
} else {
|
||||
sender.sendMessage(join(spaces(),
|
||||
text("Tried to clear", GRAY),
|
||||
asAdventure(bot.getDisplayName()).append(text("'s", GRAY)),
|
||||
text("'s action list, but following actions' stop was canceled by plugin:", GRAY)
|
||||
text("action list, but following actions' stop was canceled by plugin:", GRAY)
|
||||
));
|
||||
for (AbstractBotAction<?> action : canceled) {
|
||||
context.getSender().sendMessage(
|
||||
|
||||
Reference in New Issue
Block a user