mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 22:16:34 +00:00
Fix tab complete including vanished players, close #358
This commit is contained in:
2 files changed
+14
-5
No files matched your search
@@ -371,14 +371,18 @@ public interface HuskHomes extends TaskRunner, EventDispatcher, SafetyResolver {
|
|||||||
@NotNull
|
@NotNull
|
||||||
Map<String, List<String>> getGlobalPlayerList();
|
Map<String, List<String>> getGlobalPlayerList();
|
||||||
|
|
||||||
@NotNull
|
default List<String> getPlayerList(boolean includeVanished) {
|
||||||
default List<String> getPlayerList() {
|
|
||||||
return Stream.concat(
|
return Stream.concat(
|
||||||
getGlobalPlayerList().values().stream().flatMap(Collection::stream),
|
getGlobalPlayerList().values().stream().flatMap(Collection::stream),
|
||||||
getLocalPlayerList().stream()
|
getLocalPlayerList(includeVanished).stream()
|
||||||
).distinct().sorted().toList();
|
).distinct().sorted().toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
default List<String> getPlayerList() {
|
||||||
|
return getPlayerList(true);
|
||||||
|
}
|
||||||
|
|
||||||
default void setPlayerList(@NotNull String server, @NotNull List<String> players) {
|
default void setPlayerList(@NotNull String server, @NotNull List<String> players) {
|
||||||
getGlobalPlayerList().values().forEach(list -> {
|
getGlobalPlayerList().values().forEach(list -> {
|
||||||
list.removeAll(players);
|
list.removeAll(players);
|
||||||
@@ -388,12 +392,17 @@ public interface HuskHomes extends TaskRunner, EventDispatcher, SafetyResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
default List<String> getLocalPlayerList() {
|
default List<String> getLocalPlayerList(boolean includeVanished) {
|
||||||
return getOnlineUsers().stream()
|
return getOnlineUsers().stream()
|
||||||
|
.filter(user -> includeVanished || !user.isVanished())
|
||||||
.map(OnlineUser::getUsername)
|
.map(OnlineUser::getUsername)
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default List<String> getLocalPlayerList() {
|
||||||
|
return getLocalPlayerList(true);
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
Set<UUID> getCurrentlyOnWarmup();
|
Set<UUID> getCurrentlyOnWarmup();
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public interface UserListTabProvider extends TabProvider {
|
|||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
default List<String> suggest(@NotNull CommandUser user, @NotNull String[] args) {
|
default List<String> suggest(@NotNull CommandUser user, @NotNull String[] args) {
|
||||||
return args.length < 2 ? getPlugin().getPlayerList() : null;
|
return args.length < 2 ? getPlugin().getPlayerList(false) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
Reference in new issue
Block a user