- Renamed JsonCache to PlayerDataStorage
* the methods inside it renamed to fit with class name * cache folder changed into playerdata - Renamed LimboPlayer to PlayerData - Added fly speed to PlayerData - Removed player's name from PlayerData object - Added getPlayerLocationOrSpawn method in spawn loader.
This commit is contained in:
@@ -19,7 +19,7 @@ import fr.xephi.authme.settings.properties.PluginSettings;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import fr.xephi.authme.task.LimboPlayerTaskManager;
|
||||
import fr.xephi.authme.task.PlayerDataTaskManager;
|
||||
import fr.xephi.authme.util.BukkitService;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
import org.apache.commons.lang.reflect.MethodUtils;
|
||||
@@ -65,7 +65,7 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
private BukkitService bukkitService;
|
||||
|
||||
@Inject
|
||||
private LimboPlayerTaskManager limboPlayerTaskManager;
|
||||
private PlayerDataTaskManager playerDataTaskManager;
|
||||
|
||||
AsynchronousJoin() {
|
||||
}
|
||||
@@ -115,7 +115,7 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
return;
|
||||
}
|
||||
|
||||
limboCache.updateLimboPlayer(player);
|
||||
limboCache.updatePlayerData(player);
|
||||
|
||||
final boolean isAuthAvailable = database.isAuthAvailable(name);
|
||||
|
||||
@@ -186,8 +186,8 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
});
|
||||
|
||||
// Timeout and message task
|
||||
limboPlayerTaskManager.registerTimeoutTask(player);
|
||||
limboPlayerTaskManager.registerMessageTask(name, isAuthAvailable);
|
||||
playerDataTaskManager.registerTimeoutTask(player);
|
||||
playerDataTaskManager.registerMessageTask(name, isAuthAvailable);
|
||||
}
|
||||
|
||||
private boolean isPlayerUnrestricted(String name) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import fr.xephi.authme.cache.TempbanManager;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||
import fr.xephi.authme.cache.limbo.LimboPlayer;
|
||||
import fr.xephi.authme.cache.limbo.PlayerData;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.events.AuthMeAsyncPreLoginEvent;
|
||||
import fr.xephi.authme.output.MessageKey;
|
||||
@@ -23,7 +23,7 @@ import fr.xephi.authme.settings.properties.DatabaseSettings;
|
||||
import fr.xephi.authme.settings.properties.EmailSettings;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import fr.xephi.authme.task.LimboPlayerTaskManager;
|
||||
import fr.xephi.authme.task.PlayerDataTaskManager;
|
||||
import fr.xephi.authme.util.BukkitService;
|
||||
import fr.xephi.authme.util.StringUtils;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
@@ -70,7 +70,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
private TempbanManager tempbanManager;
|
||||
|
||||
@Inject
|
||||
private LimboPlayerTaskManager limboPlayerTaskManager;
|
||||
private PlayerDataTaskManager playerDataTaskManager;
|
||||
|
||||
AsynchronousLogin() { }
|
||||
|
||||
@@ -106,7 +106,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
service.send(player, MessageKey.USER_NOT_REGISTERED);
|
||||
|
||||
// TODO ljacqu 20160612: Why is the message task being canceled and added again here?
|
||||
limboPlayerTaskManager.registerMessageTask(name, false);
|
||||
playerDataTaskManager.registerMessageTask(name, false);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -197,9 +197,9 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
// task, we schedule it in the end
|
||||
// so that we can be sure, and have not to care if it might be
|
||||
// processed in other order.
|
||||
LimboPlayer limboPlayer = limboCache.getLimboPlayer(name);
|
||||
if (limboPlayer != null) {
|
||||
limboPlayer.clearTasks();
|
||||
PlayerData playerData = limboCache.getPlayerData(name);
|
||||
if (playerData != null) {
|
||||
playerData.clearTasks();
|
||||
}
|
||||
syncProcessManager.processSyncPlayerLogin(player);
|
||||
} else if (player.isOnline()) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.google.common.io.ByteStreams;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||
import fr.xephi.authme.cache.limbo.LimboPlayer;
|
||||
import fr.xephi.authme.cache.limbo.PlayerData;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.events.LoginEvent;
|
||||
import fr.xephi.authme.events.RestoreInventoryEvent;
|
||||
@@ -83,7 +83,7 @@ public class ProcessSyncPlayerLogin implements SynchronousProcess {
|
||||
public void processPlayerLogin(Player player) {
|
||||
final String name = player.getName().toLowerCase();
|
||||
// Limbo contains the State of the Player before /login
|
||||
final LimboPlayer limbo = limboCache.getLimboPlayer(name);
|
||||
final PlayerData limbo = limboCache.getPlayerData(name);
|
||||
final PlayerAuth auth = dataSource.getAuth(name);
|
||||
|
||||
if (limbo != null) {
|
||||
@@ -112,7 +112,7 @@ public class ProcessSyncPlayerLogin implements SynchronousProcess {
|
||||
}
|
||||
|
||||
// Clean up no longer used temporary data
|
||||
limboCache.deleteLimboPlayer(player);
|
||||
limboCache.deletePlayerData(player);
|
||||
}
|
||||
|
||||
// We can now display the join message (if delayed)
|
||||
|
||||
@@ -50,7 +50,7 @@ public class AsynchronousLogout implements AsynchronousProcess {
|
||||
database.updateQuitLoc(auth);
|
||||
}
|
||||
|
||||
limboCache.updateLimboPlayer(player);
|
||||
limboCache.updatePlayerData(player);
|
||||
playerCache.removePlayer(name);
|
||||
database.setUnlogged(name);
|
||||
syncProcessManager.processSyncPlayerLogout(player);
|
||||
|
||||
@@ -14,7 +14,7 @@ import fr.xephi.authme.process.SynchronousProcess;
|
||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.task.LimboPlayerTaskManager;
|
||||
import fr.xephi.authme.task.PlayerDataTaskManager;
|
||||
import fr.xephi.authme.util.BukkitService;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
@@ -40,7 +40,7 @@ public class ProcessSynchronousPlayerLogout implements SynchronousProcess {
|
||||
private ProtocolLibService protocolLibService;
|
||||
|
||||
@Inject
|
||||
private LimboPlayerTaskManager limboPlayerTaskManager;
|
||||
private PlayerDataTaskManager playerDataTaskManager;
|
||||
|
||||
@Inject
|
||||
private SessionManager sessionManager;
|
||||
@@ -66,8 +66,8 @@ public class ProcessSynchronousPlayerLogout implements SynchronousProcess {
|
||||
protocolLibService.sendBlankInventoryPacket(player);
|
||||
}
|
||||
|
||||
limboPlayerTaskManager.registerTimeoutTask(player);
|
||||
limboPlayerTaskManager.registerMessageTask(name, true);
|
||||
playerDataTaskManager.registerTimeoutTask(player);
|
||||
playerDataTaskManager.registerMessageTask(name, true);
|
||||
|
||||
applyLogoutEffect(player);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
||||
String ip = Utils.getPlayerIp(player);
|
||||
if (playerCache.isAuthenticated(name)) {
|
||||
if (service.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
|
||||
Location loc = player.isDead() ? spawnLoader.getSpawnLocation(player) : player.getLocation();
|
||||
Location loc = spawnLoader.getPlayerLocationOrSpawn(player);
|
||||
PlayerAuth auth = PlayerAuth.builder()
|
||||
.name(name).location(loc)
|
||||
.realName(player.getName()).build();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package fr.xephi.authme.process.quit;
|
||||
|
||||
import fr.xephi.authme.cache.backup.JsonCache;
|
||||
import fr.xephi.authme.cache.backup.PlayerDataStorage;
|
||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||
import fr.xephi.authme.cache.limbo.LimboPlayer;
|
||||
import fr.xephi.authme.cache.limbo.PlayerData;
|
||||
import fr.xephi.authme.process.ProcessService;
|
||||
import fr.xephi.authme.process.SynchronousProcess;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
@@ -16,7 +16,7 @@ import javax.inject.Inject;
|
||||
public class ProcessSyncronousPlayerQuit implements SynchronousProcess {
|
||||
|
||||
@Inject
|
||||
private JsonCache jsonCache;
|
||||
private PlayerDataStorage playerDataStorage;
|
||||
|
||||
@Inject
|
||||
private ProcessService service;
|
||||
@@ -25,26 +25,26 @@ public class ProcessSyncronousPlayerQuit implements SynchronousProcess {
|
||||
private LimboCache limboCache;
|
||||
|
||||
public void processSyncQuit(Player player) {
|
||||
LimboPlayer limbo = limboCache.getLimboPlayer(player.getName().toLowerCase());
|
||||
PlayerData limbo = limboCache.getPlayerData(player.getName().toLowerCase());
|
||||
if (limbo != null) { // it mean player is not authenticated
|
||||
// Only delete if we don't need player's last location
|
||||
if (service.getProperty(RestrictionSettings.TELEPORT_UNAUTHED_TO_SPAWN)) {
|
||||
limboCache.removeLimboPlayer(player);
|
||||
limboCache.removePlayerData(player);
|
||||
} else {
|
||||
// Restore data if its about to delete LimboPlayer
|
||||
// Restore data if its about to delete PlayerData
|
||||
if (!StringUtils.isEmpty(limbo.getGroup())) {
|
||||
Utils.addNormal(player, limbo.getGroup());
|
||||
}
|
||||
player.setOp(limbo.isOperator());
|
||||
player.setAllowFlight(limbo.isCanFly());
|
||||
player.setWalkSpeed(limbo.getWalkSpeed());
|
||||
limboCache.deleteLimboPlayer(player);
|
||||
limboCache.deletePlayerData(player);
|
||||
}
|
||||
} else {
|
||||
// Write player's location, so we could retrieve it later on player next join
|
||||
if (service.getProperty(RestrictionSettings.TELEPORT_UNAUTHED_TO_SPAWN)) {
|
||||
if (!jsonCache.doesCacheExist(player)) {
|
||||
jsonCache.writeCache(player);
|
||||
if (!playerDataStorage.hasData(player)) {
|
||||
playerDataStorage.saveData(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import fr.xephi.authme.process.ProcessService;
|
||||
import fr.xephi.authme.process.SynchronousProcess;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import fr.xephi.authme.task.LimboPlayerTaskManager;
|
||||
import fr.xephi.authme.task.PlayerDataTaskManager;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ProcessSyncEmailRegister implements SynchronousProcess {
|
||||
private ProcessService service;
|
||||
|
||||
@Inject
|
||||
private LimboPlayerTaskManager limboPlayerTaskManager;
|
||||
private PlayerDataTaskManager playerDataTaskManager;
|
||||
|
||||
ProcessSyncEmailRegister() { }
|
||||
|
||||
@@ -32,8 +32,8 @@ public class ProcessSyncEmailRegister implements SynchronousProcess {
|
||||
}
|
||||
service.send(player, MessageKey.ACCOUNT_NOT_ACTIVATED);
|
||||
|
||||
limboPlayerTaskManager.registerTimeoutTask(player);
|
||||
limboPlayerTaskManager.registerMessageTask(name, true);
|
||||
playerDataTaskManager.registerTimeoutTask(player);
|
||||
playerDataTaskManager.registerMessageTask(name, true);
|
||||
|
||||
player.saveData();
|
||||
if (!service.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.google.common.io.ByteStreams;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||
import fr.xephi.authme.cache.limbo.LimboPlayer;
|
||||
import fr.xephi.authme.cache.limbo.PlayerData;
|
||||
import fr.xephi.authme.events.LoginEvent;
|
||||
import fr.xephi.authme.events.RestoreInventoryEvent;
|
||||
import fr.xephi.authme.listener.protocollib.ProtocolLibService;
|
||||
@@ -18,7 +18,7 @@ import fr.xephi.authme.settings.properties.EmailSettings;
|
||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import fr.xephi.authme.task.LimboPlayerTaskManager;
|
||||
import fr.xephi.authme.task.PlayerDataTaskManager;
|
||||
import fr.xephi.authme.util.BukkitService;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -49,7 +49,7 @@ public class ProcessSyncPasswordRegister implements SynchronousProcess {
|
||||
private LimboCache limboCache;
|
||||
|
||||
@Inject
|
||||
private LimboPlayerTaskManager limboPlayerTaskManager;
|
||||
private PlayerDataTaskManager playerDataTaskManager;
|
||||
|
||||
ProcessSyncPasswordRegister() { }
|
||||
|
||||
@@ -82,9 +82,9 @@ public class ProcessSyncPasswordRegister implements SynchronousProcess {
|
||||
final String name = player.getName().toLowerCase();
|
||||
Utils.teleportToSpawn(player);
|
||||
|
||||
limboCache.updateLimboPlayer(player);
|
||||
limboPlayerTaskManager.registerTimeoutTask(player);
|
||||
limboPlayerTaskManager.registerMessageTask(name, true);
|
||||
limboCache.updatePlayerData(player);
|
||||
playerDataTaskManager.registerTimeoutTask(player);
|
||||
playerDataTaskManager.registerMessageTask(name, true);
|
||||
|
||||
if (player.isInsideVehicle() && player.getVehicle() != null) {
|
||||
player.getVehicle().eject();
|
||||
@@ -93,7 +93,7 @@ public class ProcessSyncPasswordRegister implements SynchronousProcess {
|
||||
|
||||
public void processPasswordRegister(Player player) {
|
||||
final String name = player.getName().toLowerCase();
|
||||
LimboPlayer limbo = limboCache.getLimboPlayer(name);
|
||||
PlayerData limbo = limboCache.getPlayerData(name);
|
||||
if (limbo != null) {
|
||||
Utils.teleportToSpawn(player);
|
||||
|
||||
@@ -105,7 +105,7 @@ public class ProcessSyncPasswordRegister implements SynchronousProcess {
|
||||
}
|
||||
}
|
||||
|
||||
limboCache.deleteLimboPlayer(player);
|
||||
limboCache.deletePlayerData(player);
|
||||
}
|
||||
|
||||
if (!Settings.getRegisteredGroup.isEmpty()) {
|
||||
|
||||
@@ -13,7 +13,7 @@ import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.task.LimboPlayerTaskManager;
|
||||
import fr.xephi.authme.task.PlayerDataTaskManager;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
@@ -41,7 +41,7 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
||||
private LimboCache limboCache;
|
||||
|
||||
@Inject
|
||||
private LimboPlayerTaskManager limboPlayerTaskManager;
|
||||
private PlayerDataTaskManager playerDataTaskManager;
|
||||
|
||||
AsynchronousUnregister() { }
|
||||
|
||||
@@ -62,9 +62,9 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
||||
if (!Settings.getRegisteredGroup.isEmpty()) {
|
||||
service.setGroup(player, AuthGroupType.UNREGISTERED);
|
||||
}
|
||||
limboCache.addLimboPlayer(player);
|
||||
limboPlayerTaskManager.registerTimeoutTask(player);
|
||||
limboPlayerTaskManager.registerMessageTask(name, false);
|
||||
limboCache.addPlayerData(player);
|
||||
playerDataTaskManager.registerTimeoutTask(player);
|
||||
playerDataTaskManager.registerMessageTask(name, false);
|
||||
|
||||
service.send(player, MessageKey.UNREGISTERED_SUCCESS);
|
||||
ConsoleLogger.info(player.getDisplayName() + " unregistered himself");
|
||||
|
||||
Reference in New Issue
Block a user