Fix IllegalArgumentException with tab completion on EditHome

This commit is contained in:
WiIIiam278 committed 2021-06-16 21:56:23 +01:00
1 parent 3f0bae97ef
commit 97df373fbb
1 file changed
+6 -1
@@ -220,7 +220,12 @@ public class EditHomeCommand extends CommandBase implements TabCompleter {
}
if (args.length == 1) {
final List<String> tabCompletions = new ArrayList<>();
StringUtil.copyPartialMatches(args[0], HomeCommand.Tab.getHomeTabCache().get(p.getUniqueId()), tabCompletions);
final List<String> homes = HomeCommand.Tab.getHomeTabCache().get(p.getUniqueId());
if (homes == null) {
HomeCommand.Tab.updatePlayerHomeCache(p);
return Collections.emptyList();
}
StringUtil.copyPartialMatches(args[0], homes, tabCompletions);
Collections.sort(tabCompletions);
return tabCompletions;
} else if (args.length == 2) {