Improved KeyedWorldArgument suggestions (#334)
This commit is contained in:
parent
b0289e8d01
commit
b3db0aab38
1 changed files with 7 additions and 6 deletions
|
|
@ -219,13 +219,14 @@ public final class KeyedWorldArgument<C> extends CommandArgument<C, World> {
|
||||||
return this.parser.suggestions(commandContext, input);
|
return this.parser.suggestions(commandContext, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<String> completions = new ArrayList<>();
|
final List<World> worlds = Bukkit.getWorlds();
|
||||||
for (final World world : Bukkit.getWorlds()) {
|
final List<String> completions = new ArrayList<>(worlds.size() * 2);
|
||||||
if (world.getKey().getNamespace().equals(NamespacedKey.MINECRAFT)) {
|
for (final World world : worlds) {
|
||||||
completions.add(world.getKey().getKey());
|
final NamespacedKey key = world.getKey();
|
||||||
} else {
|
if (!input.isEmpty() && key.getNamespace().equals(NamespacedKey.MINECRAFT_NAMESPACE)) {
|
||||||
completions.add(world.getKey().toString());
|
completions.add(key.getKey());
|
||||||
}
|
}
|
||||||
|
completions.add(key.getNamespace() + ':' + key.getKey());
|
||||||
}
|
}
|
||||||
return completions;
|
return completions;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue