mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
Internalize PAPI hook, cache SavedUser data
This commit is contained in:
1 parent
d4be673581
commit
15227ee702
14 files changed
+193
-67
No files matched your search
@@ -12,7 +12,6 @@ import net.william278.huskhomes.user.CommandUser;
|
||||
import net.william278.huskhomes.user.OnlineUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@@ -137,14 +136,14 @@ 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.getManager().homes().getUserHomes()), args);
|
||||
yield filter(plugin.getManager().homes().getUserHomeNames(), args);
|
||||
}
|
||||
yield filter(reduceHomeList(plugin.getManager().homes().getUserHomes()), args);
|
||||
yield filter(plugin.getManager().homes().getUserHomeNames(), args);
|
||||
}
|
||||
if (executor instanceof OnlineUser user) {
|
||||
yield filter(plugin.getManager().homes().getUserHomes().get(user.getUsername()), args);
|
||||
}
|
||||
yield filter(reduceHomeList(plugin.getManager().homes().getUserHomes()), args);
|
||||
yield filter(plugin.getManager().homes().getUserHomeNames(), args);
|
||||
}
|
||||
case 2 -> filter(arguments.stream().toList(), args);
|
||||
default -> List.of();
|
||||
@@ -158,11 +157,4 @@ public abstract class SavedPositionCommand<T extends SavedPosition> extends Comm
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected static List<String> reduceHomeList(@NotNull Map<String, List<String>> cachedMap) {
|
||||
final List<String> homeNames = new ArrayList<>();
|
||||
cachedMap.forEach((key, value) -> value.forEach(home -> homeNames.add(key + "." + home)));
|
||||
return homeNames;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user