Use the servers uuid cache in the output to /lp search if LP doesn't have data (#974)
This commit is contained in:
@@ -182,6 +182,19 @@ public class LPBungeeBootstrap extends Plugin implements LuckPermsBootstrap {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> lookupUsername(UUID uuid) {
|
||||
if (getProxy().getPluginManager().getPlugin("RedisBungee") != null) {
|
||||
try {
|
||||
return RedisBungeeUtil.lookupUsername(uuid);
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerCount() {
|
||||
return getProxy().getOnlineCount();
|
||||
|
||||
@@ -39,7 +39,11 @@ public final class RedisBungeeUtil {
|
||||
* @return a uuid, if present
|
||||
*/
|
||||
public static Optional<UUID> lookupUuid(String username) {
|
||||
return Optional.ofNullable(RedisBungee.getApi()).flatMap(a -> Optional.ofNullable(a.getUuidFromName(username, true)));
|
||||
return Optional.ofNullable(RedisBungee.getApi()).map(a -> a.getUuidFromName(username, true));
|
||||
}
|
||||
|
||||
public static Optional<String> lookupUsername(UUID uuid) {
|
||||
return Optional.ofNullable(RedisBungee.getApi()).map(a -> a.getNameFromUuid(uuid, true));
|
||||
}
|
||||
|
||||
private RedisBungeeUtil() {}
|
||||
|
||||
Reference in New Issue
Block a user