schlatt-co / stonks

Jschlatt sub server company management plugin
Apache License 2.0
3 stars 1 forks source link

Validation for commands is all over the place #16

Closed Tsarcasm closed 4 years ago

Tsarcasm commented 5 years ago

There must be a nicer way to perform validation for the commands. Maybe some inheritance approach to command subs could work, but this might be more complicated that it's worth. For example, a lot of commands follow the pattern: /stonks "command" It would be possible to create a subclass that validates the account id and provides the account for further logic.

There are also a lot of commands that open an account selector gui, a similar approach could be used here.

Tsarcasm commented 5 years ago

We could have a "parameter" class with its own validate method, then specify a list of allowed parameters using varargs

Tsarcasm commented 4 years ago

19 solves this nicely, I'll close this issue when it is merged