Minecord (for Discord)

Minecord (for Discord)

570k Downloads

Could not derive type for command choice

axieum opened this issue ยท 0 comments

commented

Expected behavior

For command choice types to be parsed correctly.

Observed/actual behavior

java.lang.IllegalArgumentException: Could not derive type for command choice: Reload
	at me.axieum.mcmod.minecord.impl.cmds.config.CommandConfig$BaseCommandSchema$OptionSchema.getOptionData(CommandConfig.java:292) ~[main/:?]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992) ~[?:?]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[?:?]
	at me.axieum.mcmod.minecord.impl.cmds.command.discord.CustomCommand.<init>(CustomCommand.java:78) ~[main/:?]
	at me.axieum.mcmod.minecord.impl.cmds.MinecordCommandsImpl.initCommands(MinecordCommandsImpl.java:93) ~[main/:?]
	at me.axieum.mcmod.minecord.impl.cmds.MinecordCommandsImpl.onInitializeMinecord(MinecordCommandsImpl.java:52) ~[main/:?]

Steps/models to reproduce

Add a custom command with choices, e.g.

{
    /* A Minecraft command to execute
       Usages: ${<name>} for "<name>" option value
    */
    "command": "/whitelist ${option} ${username}",
    // A list of command options
    "options": [
        {
            /* The type of option
               Allowed values: ATTACHMENT, BOOLEAN, CHANNEL, INTEGER, MENTIONABLE, NUMBER, ROLE, STRING and USER
            */
            "type": "STRING",
            // The option name
            "name": "option",
            // A brief description of what the option does
            "description": "Whether to add or remove the player from the whitelist",
            // True if the option is required
            "required": true,
            // If non-empty, restricts the value to one of the allowed choices
            "choices": [
                {
                    // The choice name
                    "name": "add",
                    // The allowed value, which type matches that of the option
                    "value": "add"
                },
                {
                    // The choice name
                    "name": "remove",
                    // The allowed value, which type matches that of the option
                    "value": "remove"
                }
            ]
        },
        {
            /* The type of option
               Allowed values: ATTACHMENT, BOOLEAN, CHANNEL, INTEGER, MENTIONABLE, NUMBER, ROLE, STRING and USER
            */
            "type": "STRING",
            // The option name
            "name": "username",
            // A brief description of what the option does
            "description": "The username or UUID of the player to whitelist",
            // True if the option is required
            "required": true,
            // If non-empty, restricts the value to one of the allowed choices
            "choices": []
        }
    ],
    // True if the command should be available for use
    "enabled": true,
    // Trigger name for the command
    "name": "whitelist",
    // A brief description of what the command does
    "description": "Adds or removes a player from the server whitelist",
    // True if the command feedback is only visible to the executor
    "ephemeral": false,
    // True if anyone can use the command by default
    "allowByDefault": false,
    // The number of seconds a user must wait before using the command again
    "cooldown": 0,
    /* To whom the cooldown applies
       Allowed values: USER, CHANNEL, USER_CHANNEL, GUILD, USER_GUILD, SHARD, USER_SHARD and GLOBAL
    */
    "cooldownScope": "USER"
}

Version

v2.0.1+1.20

Agreements

  • I am running the latest version of the mod.
  • My version of Minecraft is supported.
  • I have searched for and ensured there isn't already an open issue regarding this.

Other

No response