Use the servers uuid cache in the output to /lp search if LP doesn't have data (#974)
This commit is contained in:
@@ -47,6 +47,7 @@ import org.spongepowered.api.event.game.state.GamePreInitializationEvent;
|
||||
import org.spongepowered.api.event.game.state.GameStoppingServerEvent;
|
||||
import org.spongepowered.api.plugin.Plugin;
|
||||
import org.spongepowered.api.plugin.PluginContainer;
|
||||
import org.spongepowered.api.profile.GameProfile;
|
||||
import org.spongepowered.api.scheduler.AsynchronousExecutor;
|
||||
import org.spongepowered.api.scheduler.Scheduler;
|
||||
import org.spongepowered.api.scheduler.SpongeExecutorService;
|
||||
@@ -280,6 +281,18 @@ public class LPSpongeBootstrap implements LuckPermsBootstrap {
|
||||
.join();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> lookupUsername(UUID uuid) {
|
||||
if (!getGame().isServerAvailable()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return getGame().getServer().getGameProfileManager().get(uuid)
|
||||
.thenApply(GameProfile::getName)
|
||||
.exceptionally(x -> Optional.empty())
|
||||
.join();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerCount() {
|
||||
return getGame().isServerAvailable() ? getGame().getServer().getOnlinePlayers().size() : 0;
|
||||
|
||||
Reference in New Issue
Block a user