Remove the 'use-server-uuids' option and internal UuidCache system

The feature has stuck around since the early days - and solves a problem which really should never occur.
This commit is contained in:
Luck
2018-01-21 20:18:13 +00:00
Unverified
parent 4c3e28ba85
commit 72d4e5cf7a
28 changed files with 52 additions and 304 deletions
@@ -66,7 +66,6 @@ import me.lucko.luckperms.common.tasks.CacheHousekeepingTask;
import me.lucko.luckperms.common.tasks.ExpireTemporaryTask;
import me.lucko.luckperms.common.tasks.UpdateTask;
import me.lucko.luckperms.common.treeview.PermissionVault;
import me.lucko.luckperms.common.utils.UuidCache;
import me.lucko.luckperms.common.verbose.VerboseHandler;
import me.lucko.luckperms.sponge.calculators.SpongeCalculatorFactory;
import me.lucko.luckperms.sponge.commands.SpongeMainCommand;
@@ -173,7 +172,6 @@ public class LPSpongePlugin implements LuckPermsSpongePlugin {
private Storage storage;
private FileWatcher fileWatcher = null;
private InternalMessagingService messagingService = null;
private UuidCache uuidCache;
private LuckPermsApiProvider apiProvider;
private EventFactory eventFactory;
private me.lucko.luckperms.common.logging.Logger log;
@@ -243,7 +241,6 @@ public class LPSpongePlugin implements LuckPermsSpongePlugin {
// load internal managers
getLog().info("Loading internal permission managers...");
this.uuidCache = new UuidCache(this);
this.userManager = new SpongeUserManager(this);
this.groupManager = new SpongeGroupManager(this);
this.trackManager = new StandardTrackManager(this);
@@ -410,7 +407,7 @@ public class LPSpongePlugin implements LuckPermsSpongePlugin {
return null;
}
return this.game.getServer().getPlayer(this.uuidCache.getExternalUUID(user.getUuid())).orElse(null);
return this.game.getServer().getPlayer(user.getUuid()).orElse(null);
}
@Override
@@ -580,11 +577,6 @@ public class LPSpongePlugin implements LuckPermsSpongePlugin {
return this.storage;
}
@Override
public UuidCache getUuidCache() {
return this.uuidCache;
}
@Override
public LuckPermsApiProvider getApiProvider() {
return this.apiProvider;
@@ -29,7 +29,6 @@ import me.lucko.luckperms.common.config.ConfigKeys;
import me.lucko.luckperms.common.locale.Message;
import me.lucko.luckperms.common.model.User;
import me.lucko.luckperms.common.utils.AbstractLoginListener;
import me.lucko.luckperms.common.utils.UuidCache;
import me.lucko.luckperms.sponge.LPSpongePlugin;
import org.spongepowered.api.event.Listener;
@@ -126,7 +125,7 @@ public class SpongeConnectionListener extends AbstractLoginListener {
this.plugin.getLog().info("Processing login event for " + player.getUniqueId() + " - " + player.getName());
}
final User user = this.plugin.getUserManager().getIfLoaded(this.plugin.getUuidCache().getUUID(player.getUniqueId()));
final User user = this.plugin.getUserManager().getIfLoaded(player.getUniqueId());
/* User instance is null for whatever reason. Could be that it was unloaded between asyncpre and now. */
if (user == null) {
@@ -158,15 +157,6 @@ public class SpongeConnectionListener extends AbstractLoginListener {
@Listener(order = Order.POST)
public void onClientLeave(ClientConnectionEvent.Disconnect e) {
/* We don't actually remove the user instance here, as Sponge likes to keep performing checks
on players when they disconnect. The instance gets cleared up on a housekeeping task
after a period of inactivity. */
final UuidCache cache = this.plugin.getUuidCache();
// Unload the user from memory when they disconnect
cache.clearCache(e.getTargetEntity().getUniqueId());
// Register with the housekeeper, so the User's instance will stick
// around for a bit after they disconnect
this.plugin.getUserManager().getHouseKeeper().registerUsage(e.getTargetEntity().getUniqueId());
@@ -87,7 +87,7 @@ public class SpongeUser extends User {
@Override
public String getIdentifier() {
return this.plugin.getUuidCache().getExternalUUID(this.parent.getUuid()).toString();
return this.parent.getUuid().toString();
}
@Override
@@ -97,7 +97,7 @@ public class SpongeUser extends User {
@Override
public Optional<CommandSource> getCommandSource() {
final UUID uuid = this.plugin.getUuidCache().getExternalUUID(this.parent.getUuid());
final UUID uuid = this.parent.getUuid();
return Sponge.getServer().getPlayer(uuid).map(Function.identity());
}
-27
View File
@@ -38,33 +38,6 @@ apply-global-groups=true
# If users on this server should have global (non-world specific) groups applied
apply-global-world-groups=true
# If UUIDs should be pulled from the server, or looked up by username based upon previous
# connections.
#
# This option should be set to true in most cases. When set to false, in order to get a player's
# UUID, LuckPerms will:
#
# 1. Check if a player with the given username has joined before, if they have, use the UUID they
# used on their previous login.
# 2. Save and return the players "current" uuid.
#
# For offline mode (cracked) servers, a players UUID is generated based upon their username.
#
# IMPORTANT:
# If you are using BungeeCord proxy running in online mode, it is important that "online-mode=false"
# is set in server.properties, but "bungeecord: true" is set in the spigot.yml. You also need to set
# "ip_forward: true" in BungeeCord's config.yml.
#
# If for whatever reason you are not able to do this, and do not have ip-forward enabled, then you
# may need to set "use-server-uuids" to false.
#
# If your proxy is running in offline mode, you should still be setting up ip-forwarding as
# described above.
#
# This option only really exists for networks who for whatever reason cannot setup proper ip
# 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