Switched 4 commands to EnumParser for cleaner autocomplete, close #801

This commit is contained in:
Bella 2020-05-10 14:05:36 -04:00
parent df06025019
commit c25a923f3a
No known key found for this signature in database
GPG Key ID: DBD4A6030080C8B3
4 changed files with 8 additions and 4 deletions

View File

@ -2,6 +2,7 @@ package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
import me.zeroeightsix.kami.command.syntax.parsers.EnumParser;
import me.zeroeightsix.kami.command.syntax.parsers.ModuleParser;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
@ -23,7 +24,7 @@ public class BindCommand extends Command {
public BindCommand() {
super("bind", new ChunkBuilder()
.append("[module]|modifiers", true, new ModuleParser())
.append("[key]|[on|off]", true)
.append("state", true, new EnumParser(new String[]{"key", "on", "off"}))
.build()
);
setDescription("Binds a module to a key, or allows you to change modifier options");

View File

@ -2,6 +2,7 @@ package me.zeroeightsix.kami.command.commands
import me.zeroeightsix.kami.command.Command
import me.zeroeightsix.kami.command.syntax.ChunkBuilder
import me.zeroeightsix.kami.command.syntax.parsers.EnumParser
import me.zeroeightsix.kami.module.MacroManager
import me.zeroeightsix.kami.module.Macros
import me.zeroeightsix.kami.util.Macro
@ -12,7 +13,7 @@ import me.zeroeightsix.kami.util.Wrapper
* @author dominikaaaa
* Created by dominikaaaa on 04/05/20
*/
class MacroCommand : Command("macro", ChunkBuilder().append("key|list").append("clear|message/command").build(), "m") {
class MacroCommand : Command("macro", ChunkBuilder().append("command", true, EnumParser(arrayOf("key", "list"))).append("setting", false, EnumParser(arrayOf("clear", "message|command"))).build(), "m") {
override fun call(args: Array<out String?>) {
val rKey = args[0]
val macro = args[1]

View File

@ -2,6 +2,7 @@ package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
import me.zeroeightsix.kami.command.syntax.parsers.EnumParser;
import me.zeroeightsix.kami.command.syntax.parsers.ModuleParser;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.setting.ISettingUnknown;
@ -24,7 +25,7 @@ public class SetCommand extends Command {
super("set", new ChunkBuilder()
.append("module", true, new ModuleParser())
.append("setting", true)
.append("value|toggle", true)
.append("set", true, new EnumParser(new String[]{"value", "toggle"}))
.build());
setDescription("Change the setting of a certain module");
}

View File

@ -2,6 +2,7 @@ package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
import me.zeroeightsix.kami.command.syntax.parsers.EnumParser;
import me.zeroeightsix.kami.module.modules.render.XRay;
import net.minecraft.block.Block;
@ -15,7 +16,7 @@ import static me.zeroeightsix.kami.util.MessageSendHelper.*;
*/
public class XRayCommand extends Command {
public XRayCommand() {
super("xray", new ChunkBuilder().append("help").append("+block|-block|=block").append("list|defaults|clear|invert").build());
super("xray", new ChunkBuilder().append("command", true, new EnumParser(new String[]{"help", "list", "+block", "-block", "=block", "defaults", "clear", "invert"})).build());
setDescription("Allows you to add or remove blocks from the &fxray &7module");
}