add refillcore and fix help
This commit is contained in:
parent
ac8ab4d74d
commit
40f936090f
4 changed files with 51 additions and 3 deletions
|
@ -98,11 +98,10 @@ public class HelpCommand implements Command {
|
|||
|
||||
final String prefix = bot.chatCommandHandler().prefix();
|
||||
|
||||
final String commandName = args[0];
|
||||
|
||||
for (Command command : bot.commandHandler().commands()) {
|
||||
if (!command.name().equals(commandName) && !command.alias().contains(commandName)) continue;
|
||||
if (!command.name().equals(args[0]) && !command.alias().contains(args[0])) continue;
|
||||
|
||||
final String commandName = command.name();
|
||||
final List<Component> usages = new ArrayList<>();
|
||||
|
||||
usages.add(
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package me.chayapak1.chomens_bot.commands;
|
||||
|
||||
import me.chayapak1.chomens_bot.Bot;
|
||||
import me.chayapak1.chomens_bot.command.Command;
|
||||
import me.chayapak1.chomens_bot.command.CommandContext;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RefillCoreCommand implements Command {
|
||||
public String name() { return "refillcore"; }
|
||||
|
||||
public String description() {
|
||||
return "Refills and resets the bot's command core";
|
||||
}
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
usages.add("");
|
||||
|
||||
return usages;
|
||||
}
|
||||
|
||||
public List<String> alias() {
|
||||
final List<String> aliases = new ArrayList<>();
|
||||
aliases.add("rc");
|
||||
|
||||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
||||
bot.core().reset();
|
||||
bot.core().refill();
|
||||
|
||||
return Component.text("success");
|
||||
}
|
||||
}
|
|
@ -32,6 +32,7 @@ public class CommandHandlerPlugin {
|
|||
registerCommand(new BotVisibilityCommand());
|
||||
registerCommand(new TPSBarCommand());
|
||||
registerCommand(new NetMessageCommand());
|
||||
registerCommand(new RefillCoreCommand());
|
||||
}
|
||||
|
||||
public void registerCommand (Command command) {
|
||||
|
|
|
@ -127,6 +127,10 @@ public class CorePlugin extends PositionPlugin.PositionListener {
|
|||
}
|
||||
}
|
||||
|
||||
public void reset () {
|
||||
relativeCorePosition = Vector3i.from(coreStart);
|
||||
}
|
||||
|
||||
public void refill () {
|
||||
final String command = String.format(
|
||||
"minecraft:fill %s %s %s %s %s %s minecraft:command_block{CustomName:'%s'}",
|
||||
|
|
Loading…
Reference in a new issue