mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
Prevent home command tab completion throwing exceptions for un-cached users
This commit is contained in:
1 parent
3232a38b63
commit
4832d69131
7 files changed
+35
-17
No files matched your search
@@ -342,12 +342,15 @@ public class EditHomeCommand extends CommandBase implements TabCompletable {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return switch (args.length) {
|
||||
case 0, 1 -> plugin.getCache().homes.get(user.uuid).stream()
|
||||
case 0, 1 -> plugin.getCache().homes.getOrDefault(user.uuid, new ArrayList<>())
|
||||
.stream()
|
||||
.filter(s -> s.toLowerCase().startsWith(args.length == 1 ? args[0].toLowerCase() : ""))
|
||||
.sorted().collect(Collectors.toList());
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
case 2 -> Arrays.stream(EDIT_HOME_COMPLETIONS)
|
||||
.filter(s -> s.toLowerCase().startsWith(args[1].toLowerCase()))
|
||||
.sorted().collect(Collectors.toList());
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
default -> Collections.emptyList();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user