Refactor cached data away from cache

This commit is contained in:
William committed 2023-03-21 19:23:45 +00:00
1 parent b095c92854
commit a959aa9519
14 files changed
+166 -373

No files matched your search

@@ -27,7 +27,7 @@ public class PublicHomeCommand extends HomeCommand {
@NotNull
public List<String> suggest(@NotNull CommandUser executor, @NotNull String[] args) {
if (args.length <= 2) {
return filter(reduceHomeList(plugin.getCache().getHomes()), args);
return filter(reduceHomeList(plugin.getManager().homes().getPublicHomes()), args);
}
return List.of();
}
@@ -128,21 +128,21 @@ public abstract class SavedPositionCommand<T extends SavedPosition> extends Comm
case 0, 1 -> {
if (args.length == 1 && args[0].contains(".")) {
if (executor.hasPermission(getOtherPermission())) {
yield filter(reduceHomeList(plugin.getCache().getHomes()), args);
yield filter(reduceHomeList(plugin.getManager().homes().getUserHomes()), args);
}
yield filter(reduceHomeList(plugin.getCache().getHomes()), args);
yield filter(reduceHomeList(plugin.getManager().homes().getUserHomes()), args);
}
if (executor instanceof OnlineUser user) {
yield filter(plugin.getCache().getHomes().get(user.getUsername()), args);
yield filter(plugin.getManager().homes().getUserHomes().get(user.getUsername()), args);
}
yield filter(reduceHomeList(plugin.getCache().getHomes()), args);
yield filter(reduceHomeList(plugin.getManager().homes().getUserHomes()), args);
}
case 2 -> filter(arguments.stream().toList(), args);
default -> List.of();
};
} else {
return switch (args.length) {
case 0, 1 -> filter(plugin.getCache().getWarps(), args);
case 0, 1 -> filter(plugin.getManager().warps().getWarps(), args);
case 2 -> filter(arguments.stream().toList(), args);
default -> List.of();
};