So i’ve found Sponge’s way of handling arguments a lot different then Bukkit’s way which im used to. So i have my Plugin MultiWorld. Main Plugin command /mw
without arguments just returns Version and other miscellaneous info. But otherwise is structured like this
/mw <create|delete|modify|tp|join>
now each sub command has its own arguments also. I wish there was a way on the main command spec to disable sponge argument handling like
CommandSpec commandSpec = CommandSpec.builder()
.permission(...)
.description(...)
.disableSpongeHandling(true)
.executor(...)
.build()
even though it has its own implemented way of handling arguments its a little out of the ordinary and developers should be able to choose. But i digress from what my real question is. Im trying which way to handle the arguments for my plugin. The command structure is laid out as such…
<>
are required arguments
[]
are optional arguments
/mw create <name> [type] [seed]
/mw delete <name>
/mw modify <type> <value>
/mw tp <world> <x> <y> <z>
/mw join <world>
Im currently using this option
// /mw create <name> [type] [seed] Command
CommandSpec create = CommandSpec.builder()
.description(Texts.of("Create a world"))
.executor(new Command())
.arguments(GenericArguments.seq(
GenericArguments.string(Texts.of("name")),
GenericArguments.dimension(Texts.of("type"), game),
GenericArguments.integer(Texts.of("seed"))
))
.build();
// /mw delete <name> command
CommandSpec delete = CommandSpec.builder()
.description(Texts.of("Delete a world"))
.executor(new Command())
.arguments(GenericArguments.string(Texts.of("name")))
.build();
// /mw help command
CommandSpec help = CommandSpec.builder()
.description(Texts.of("MultiWorld help Command"))
.executor(new Command())
.build();
// /mw modify <type> <value> command
Map<String, Boolean> choices = new HashMap<String, Boolean>();
CommandSpec modify = CommandSpec.builder()
.description(Texts.of("Modify your current world"))
.executor(new Command())
.arguments(GenericArguments.seq(GenericArguments.string(Texts.of("type")), GenericArguments.choices(Texts.of("value"), choices)))
.build();
// /mw version command
CommandSpec version = CommandSpec.builder()
.description(Texts.of("MultiWorld version"))
.executor(new Command())
.build();
// /tp <world> <x> <y> <z> command.
CommandSpec tp = CommandSpec.builder()
.description(Texts.of("Teleport to a world at an exact location"))
.executor(new Command())
.arguments(GenericArguments.seq(GenericArguments.world(Texts.of("world"), game), GenericArguments.integer(Texts.of("x")), GenericArguments.integer(Texts.of("y")), GenericArguments.integer(Texts.of("z"))))
.build();
// /join <world> command
CommandSpec join = CommandSpec.builder()
.description(Texts.of("Join a world at its spawn."))
.executor(new Command())
.arguments(GenericArguments.world(Texts.of("world"), game))
.build();
CommandSpec mwCommandSpec = CommandSpec.builder()
.description(Texts.of("MultiWorld Command"))
.child(create, "create")
.child(delete, "delete")
.child(modify, "modify")
.child(version, "version")
.child(tp, "tp")
.child(join, "join")
.child(help, "help")
.executor(new Command())
.build();
But the way its handling it now is not how i want it to and it doesnt handle well. In the executor i have set it to handle the arguments i just need a way to make the command ignore Sponge’s handling.