question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optional/Different Arguments regression

See original GitHub issue

CommandAPI version CommandAPI 4.1

Minecraft version 1.14.4

Describe the bug In older versions (eg. 2.3) you could create coexisting sets of arguments, but I cannot get that to work anymore.

My code This code reproduces the behavior:

LinkedHashMap<String, Argument> arguments;

arguments = new LinkedHashMap<String, Argument>();
arguments.put("start", new LiteralArgument("start"));
new CommandAPICommand("mycommand").withArguments(arguments).withPermission(CommandPermission.fromString("hamarb123.mycommand")).executes((sender, args) -> {
    //blah
}).register();

arguments = new LinkedHashMap<String, Argument>();
arguments.put("stop", new LiteralArgument("stop"));
new CommandAPICommand("mycommand").withArguments(arguments).withPermission(CommandPermission.fromString("hamarb123.mycommand")).executes((sender, args) -> {
    //blah
}).register();

Expected behavior It should have all of the command variants that have been registered appearing.

Screenshots Screen Shot 2020-09-09 at 2 05 28 pm Screen Shot 2020-09-09 at 2 05 56 pm

Additional context The documentation at https://www.jorel.dev/CommandAPI/4.1/arguments.html gives the impression that I shouldn’t need any other weird code. Also, the example on the website works properly.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
JorelAlicommented, Sep 11, 2020

@hamarb123 Evening, After having a look at the sample code from your previous comment, I realized you forgot to add .register() to the end of all of your literals! Whoops!!

After adding .register() to the end, I can generate the following:

command_registration.json

    "assassin": {
      "type": "literal",
      "children": {
        "assassins": {
          "type": "literal",
          "children": {
            "add": {
              "type": "literal",
              "children": {
                "players": {
                  "type": "argument",
                  "parser": "minecraft:entity",
                  "properties": {
                    "amount": "multiple",
                    "type": "players"
                  },
                  "executable": true
                }
              }
            },
            "clear": {
              "type": "literal",
              "executable": true
            },
            "list": {
              "type": "literal",
              "executable": true
            },
            "remove": {
              "type": "literal",
              "children": {
                "players": {
                  "type": "argument",
                  "parser": "minecraft:entity",
                  "properties": {
                    "amount": "multiple",
                    "type": "players"
                  },
                  "executable": true
                }
              }
            }
          }
        },
        "mode": {
          "type": "literal",
          "children": {
            "assassin": {
              "type": "literal",
              "executable": true
            },
            "manhunt": {
              "type": "literal",
              "executable": true
            }
          },
          "executable": true
        },
        "query": {
          "type": "literal",
          "children": {
            "enableCompass": {
              "type": "literal",
              "executable": true
            },
            "freezeRange": {
              "type": "literal",
              "executable": true
            }
          }
        },
        "set": {
          "type": "literal",
          "children": {
            "enableCompass": {
              "type": "literal",
              "children": {
                "compassBoolean": {
                  "type": "argument",
                  "parser": "brigadier:bool",
                  "executable": true
                }
              }
            },
            "freezeRange": {
              "type": "literal",
              "children": {
                "distance": {
                  "type": "argument",
                  "parser": "brigadier:integer",
                  "properties": {
                    "min": 1
                  },
                  "executable": true
                }
              }
            }
          }
        },
        "start": {
          "type": "literal",
          "executable": true
        },
        "status": {
          "type": "literal",
          "executable": true
        },
        "stop": {
          "type": "literal",
          "executable": true
        },
        "target": {
          "type": "literal",
          "children": {
            "query": {
              "type": "literal",
              "executable": true
            },
            "set": {
              "type": "literal",
              "children": {
                "player": {
                  "type": "argument",
                  "parser": "minecraft:entity",
                  "properties": {
                    "amount": "single",
                    "type": "players"
                  },
                  "executable": true
                }
              }
            },
            "unset": {
              "type": "literal",
              "executable": true
            }
          }
        }
      }
    },

In Minecraft 1.16.2, using the sample code from the first comment, I was unable to reproduce the issue: image

Perhaps it’s a 1.14.4-specific issue? I’ll research later today to see if that’s the case.

0reactions
JorelAlicommented, Sep 11, 2020

I personally think having the multiple command executors is quite a useful feature, so don’t plan on dropping it anytime soon ¯_(ツ)_/¯.

You’ve made a few plugins that use the CommandAPI! If you have time to spare, feel free to join my (really really small) Discord server - I’d be honoured to have you on board 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mathematical Foundations – Introduction to Machine Learning
In this section we will establish the mathematical foundations of machine learning. We will define three important quantities: data, models, ...
Read more >
What if the Regression Equation Contains "Wrong" Predictors?
The regression model contains one or more "extraneous variables. ... from all possible random samples equals the parameter you're trying to estimate.
Read more >
Use of multivariate statistical methods for the analysis ... - RiuNet
and obtains more robust parameters when compared to PLS while, at the same ... 3.8 Elastic net regression for a linear model with...
Read more >
Genomic Prediction Using Individual-Level Data and ... - NCBI
A standard marker model, using random regression on marker genotypes, ... 2012) with optional different weights in B i (to differentially shrink different ......
Read more >
An antigen microarray protocol for COVID-19 serological ...
Optional: Different arrangements of the antigens can be created using ... default parameters and the 'Print Plan' that was prepared above.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found