Interface IArgConsumer


public interface IArgConsumer
The IArgConsumer is how ICommands read the arguments passed to them. This class has many benefits:
  • Mutability. The whole concept of the IArgConsumer} is to let you gradually consume arguments in any way you'd like. You can change your consumption based on earlier arguments, for subcommands for example.
  • You don't need to keep track of your consumption. The IArgConsumer} keeps track of the arguments you consume so that it can throw detailed exceptions whenever something is out of the ordinary. Additionally, if you need to retrieve an argument after you've already consumed it - look no further than consumed()!
  • Easy retrieval of many different types. If you need to retrieve an instance of an int or float for example, look no further than getAs(Class). If you need a more powerful way of retrieving data, try out the many getDatatype... methods.
  • It's very easy to throw detailed exceptions. The IArgConsumer} has many different methods that can enforce the number of arguments, the type of arguments, and more, throwing different types of CommandExceptions if something seems off. You're recommended to do all validation and store all needed data in variables BEFORE logging any data to chat via Helper.logDirect(String), so that the error handlers can do their job and log the error to chat.