Add option to use the servers uuid cache/lookup facility (#354)

This commit is contained in:
Luck
2017-07-03 16:07:33 +01:00
Unverified
parent 7d4aca68cc
commit d2bf940105
15 changed files with 145 additions and 9 deletions
@@ -510,6 +510,17 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
return getServer().getPlayer(uuidCache.getExternalUUID(user.getUuid()));
}
@Override
public Optional<UUID> lookupUuid(String username) {
try {
//noinspection deprecation
return Optional.ofNullable(getServer().getOfflinePlayer(username)).flatMap(p -> Optional.ofNullable(p.getUniqueId()));
} catch (Exception e) {
e.printStackTrace();
return Optional.empty();
}
}
@Override
public Contexts getContextForUser(User user) {
Player player = getPlayer(user);
+4
View File
@@ -66,6 +66,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