| Conditions | 5 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package de.pewpewproject.lasertag.command.suggestions; |
||
| 33 | @Override |
||
| 34 | public CompletableFuture<Suggestions> getSuggestions(CommandContext<ServerCommandSource> context, SuggestionsBuilder builder) { |
||
| 35 | boolean inputEmpty = false; |
||
| 36 | // Try to get current input |
||
| 37 | String input = null; |
||
| 38 | try { |
||
| 39 | input = StringArgumentType.getString(context, "gamemode"); |
||
| 40 | } catch (IllegalArgumentException ex) { |
||
| 41 | inputEmpty = true; |
||
| 42 | } |
||
| 43 | |||
| 44 | for (var gameModeTranslatableName : GameModes.GAME_MODES.keySet()) { |
||
| 45 | |||
| 46 | if (inputEmpty || gameModeTranslatableName.toLowerCase().contains(input.toLowerCase())) { |
||
| 47 | builder.suggest(gameModeTranslatableName); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | return builder.buildFuture(); |
||
| 52 | } |
||
| 54 |