Rename DataFileCache to PlayerData
This commit is contained in:
+11
-21
@@ -1,9 +1,8 @@
|
||||
package fr.xephi.authme.cache.limbo;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.backup.DataFileCache;
|
||||
import fr.xephi.authme.cache.backup.JsonCache;
|
||||
import fr.xephi.authme.cache.backup.PlayerData;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -19,7 +18,7 @@ public class LimboCache {
|
||||
private volatile static LimboCache singleton;
|
||||
public final ConcurrentHashMap<String, LimboPlayer> cache;
|
||||
public final AuthMe plugin;
|
||||
private final JsonCache playerData;
|
||||
private final JsonCache jsonCache;
|
||||
|
||||
/**
|
||||
* Constructor for LimboCache.
|
||||
@@ -29,7 +28,7 @@ public class LimboCache {
|
||||
private LimboCache(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.cache = new ConcurrentHashMap<>();
|
||||
this.playerData = new JsonCache();
|
||||
this.jsonCache = new JsonCache();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,30 +51,21 @@ public class LimboCache {
|
||||
public void addLimboPlayer(Player player) {
|
||||
String name = player.getName().toLowerCase();
|
||||
Location loc = player.getLocation();
|
||||
boolean operator = false;
|
||||
boolean flyEnabled = false;
|
||||
boolean operator = player.isOp();
|
||||
boolean flyEnabled = player.getAllowFlight();
|
||||
String playerGroup = "";
|
||||
PermissionsManager permsMan = plugin.getPermissionsManager();
|
||||
if (permsMan.hasGroupSupport()) {
|
||||
playerGroup = permsMan.getPrimaryGroup(player);
|
||||
}
|
||||
|
||||
// Get the permissions manager, and make sure it's valid
|
||||
PermissionsManager permsMan = this.plugin.getPermissionsManager();
|
||||
if (permsMan == null)
|
||||
ConsoleLogger.showError("Unable to access permissions manager!");
|
||||
assert permsMan != null;
|
||||
|
||||
if (playerData.doesCacheExist(player)) {
|
||||
DataFileCache cache = playerData.readCache(player);
|
||||
if (jsonCache.doesCacheExist(player)) {
|
||||
PlayerData cache = jsonCache.readCache(player);
|
||||
if (cache != null) {
|
||||
playerGroup = cache.getGroup();
|
||||
operator = cache.getOperator();
|
||||
flyEnabled = cache.isFlyEnabled();
|
||||
}
|
||||
} else {
|
||||
operator = player.isOp();
|
||||
|
||||
// Check whether groups are supported
|
||||
if (permsMan.hasGroupSupport()) {
|
||||
playerGroup = permsMan.getPrimaryGroup(player);
|
||||
}
|
||||
}
|
||||
|
||||
if (player.isDead()) {
|
||||
|
||||
Reference in New Issue
Block a user