mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
Fallback to uuid in the search command if the username is unknown
This commit is contained in:
parent
00895fc7ab
commit
0b6f326c18
@ -72,8 +72,8 @@ public class SearchCommand extends SingleCommand {
|
||||
Map<UUID, String> uuidLookups = new HashMap<>();
|
||||
Function<UUID, String> lookupFunc = uuid -> uuidLookups.computeIfAbsent(uuid, u -> {
|
||||
String s = plugin.getStorage().getName(u).join();
|
||||
if (s == null) {
|
||||
s = "null";
|
||||
if (s == null || s.isEmpty() || s.equals("null")) {
|
||||
s = u.toString();
|
||||
}
|
||||
return s;
|
||||
});
|
||||
|
@ -281,13 +281,15 @@ public class Util {
|
||||
int index = pageNumber - 1;
|
||||
List<List<HeldPermission<UUID>>> pages = divideList(sorted, 15);
|
||||
|
||||
if ((index < 0 || index >= pages.size())) {
|
||||
if (index < 0 || index >= pages.size()) {
|
||||
pageNumber = 1;
|
||||
index = 0;
|
||||
}
|
||||
|
||||
List<HeldPermission<UUID>> page = pages.get(index);
|
||||
List<Map.Entry<String, HeldPermission<UUID>>> uuidMappedPage = page.stream().map(hp -> Maps.immutableEntry(uuidLookup.apply(hp.getHolder()), hp)).collect(Collectors.toList());
|
||||
List<Map.Entry<String, HeldPermission<UUID>>> uuidMappedPage = page.stream()
|
||||
.map(hp -> Maps.immutableEntry(uuidLookup.apply(hp.getHolder()), hp))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
FancyMessage message = new FancyMessage("");
|
||||
String title = "&7(page &f" + pageNumber + "&7 of &f" + pages.size() + "&7 - &f" + sorted.size() + "&7 entries)";
|
||||
@ -316,7 +318,7 @@ public class Util {
|
||||
int index = pageNumber - 1;
|
||||
List<List<HeldPermission<String>>> pages = divideList(sorted, 15);
|
||||
|
||||
if ((index < 0 || index >= pages.size())) {
|
||||
if (index < 0 || index >= pages.size()) {
|
||||
pageNumber = 1;
|
||||
index = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user