aikar / aikar/commands

Command completion mixing @players with "enum" values

Abierto
#250 6 comentarios 0 reacciones 0 asignados Ver en GitHub
core
Lenguaje dominante
Java
Estrellas
628
Forks
150
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I'm trying create a slightly improved version of the vanilla `/gamemode` command. This, unfortunately appears to break tab completion in a way. The gamemode command should operate as follows:

* `/gamemode creative` - Sets the executor's gamemode to creative
* `/gamemode Dinnerbone` - Toggle's Dinnerbone's gamemode between creative and survival

Ideally, the tab completion when typing `/gamemode ` should both suggest online players and the actual valid gamemode ids (survival, creative, etc.). This is what I attempted to use to achieve this:
```
@Default
@CommandCompletion("@players|survival|creative|adventure|spectator")
public void setOwnOrToggleOtherGameMode(Player player, @Single String arg) {
// ...
}
```

This, however makes the tab completion _only_ suggest online players; the options for the game mode ids are no suggested at all.

I also had these separated into two different methods (one designed to only handle online players and the other designed to handle toggling the executor's game mode), but while they both worked, it again only suggested online players and not the game mode ids.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.