Skip to content

Commit

Permalink
Improved KeyedWorldArgument suggestions (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Feb 28, 2022
1 parent e109ecb commit e32ec69
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,14 @@ public Parser() {
return this.parser.suggestions(commandContext, input);
}

final List<String> completions = new ArrayList<>();
for (final World world : Bukkit.getWorlds()) {
if (world.getKey().getNamespace().equals(NamespacedKey.MINECRAFT)) {
completions.add(world.getKey().getKey());
} else {
completions.add(world.getKey().toString());
final List<World> worlds = Bukkit.getWorlds();
final List<String> completions = new ArrayList<>(worlds.size() * 2);
for (final World world : worlds) {
final NamespacedKey key = world.getKey();
if (!input.isEmpty() && key.getNamespace().equals(NamespacedKey.MINECRAFT_NAMESPACE)) {
completions.add(key.getKey());
}
completions.add(key.getNamespace() + ':' + key.getKey());
}
return completions;
}
Expand Down

0 comments on commit e32ec69

Please sign in to comment.