Skip to content

Commit

Permalink
Return empty list if world not found in tab complete. #702
Browse files Browse the repository at this point in the history
  • Loading branch information
kernitus committed Jan 8, 2024
1 parent a01a746 commit 2071fb0
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -45,7 +46,9 @@ public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Comman
if (sender instanceof Player) { // Get the modesets allowed in the world player is in
final World world = ((Player) sender).getWorld();
completions.addAll(
Config.getWorlds().get(world.getUID()).stream()
Config.getWorlds()
.getOrDefault(world.getUID(), new LinkedHashSet<>())
.stream()
.filter(ms -> ms.startsWith(args[1]))
.collect(Collectors.toList()));
} else {
Expand Down

0 comments on commit 2071fb0

Please sign in to comment.