aikar / aikar/commands

Add @ConsumesRest annotation

Aperta
#431 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
628
Fork
150
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

For example, I have my own parsing logic for flags where the order does not matter:
```
/mv entities --name test --eat
/mv entities --eat
/mv entities --eat --name test
```

Currently what I have to do is as ACF only allows String[] and String to parse more than 1 command arg:
```
void onCommand(... String[] flagArr) {
Flags flags = parseFlags(flagArr);
// ...
}
```

My suggestion is add a @ConsumesRest annotation which will allow our own custom classes to consume all the args as well, e.g.:
```
void onCommand(... @ConsumesRest Flags flag) {
}

// Command context for Flags will be registered
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.