Add option to use the servers uuid cache/lookup facility (#354)
This commit is contained in:
@@ -93,6 +93,7 @@ import org.spongepowered.api.event.game.state.GamePostInitializationEvent;
|
||||
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.profile.GameProfile;
|
||||
import org.spongepowered.api.scheduler.AsynchronousExecutor;
|
||||
import org.spongepowered.api.scheduler.Scheduler;
|
||||
import org.spongepowered.api.scheduler.SpongeExecutorService;
|
||||
@@ -109,9 +110,12 @@ import java.util.AbstractCollection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
@@ -391,6 +395,17 @@ public class LPSpongePlugin implements LuckPermsPlugin {
|
||||
return game.getServer().getPlayer(uuidCache.getExternalUUID(user.getUuid())).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UUID> lookupUuid(String username) {
|
||||
CompletableFuture<GameProfile> fut = game.getServer().getGameProfileManager().get(username);
|
||||
try {
|
||||
return Optional.of(fut.get().getUniqueId());
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Contexts getContextForUser(User user) {
|
||||
Player player = getPlayer(user);
|
||||
|
||||
@@ -65,6 +65,10 @@ apply-global-world-groups=true
|
||||
# forwarding.
|
||||
use-server-uuids=true
|
||||
|
||||
# If the servers own UUID cache/lookup facility should be used when there is no record for a player
|
||||
# in the LuckPerms cache.
|
||||
use-server-uuid-cache=false
|
||||
|
||||
# If the plugin should send log notifications to users whenever permissions are modified.
|
||||
log-notify=true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user