Package cleanup

- authme.cache to authme.data
- Rename PlayerData to LimboPlayer to match with LimboCache
- Move authme.converter to authme.datasource.converter
- Split output package into output and message
This commit is contained in:
Gabriele C 2016-10-04 21:49:14 +02:00 committed by ljacqu
parent 7e2912cc60
commit 58c42cf300
149 changed files with 491 additions and 475 deletions

View File

@ -5,8 +5,8 @@ import ch.jalu.injector.InjectorBuilder;
import com.google.common.annotations.VisibleForTesting;
import fr.xephi.authme.api.API;
import fr.xephi.authme.api.NewAPI;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.command.CommandHandler;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.initialization.DataFolder;
@ -21,7 +21,7 @@ import fr.xephi.authme.listener.PlayerListener16;
import fr.xephi.authme.listener.PlayerListener18;
import fr.xephi.authme.listener.PlayerListener19;
import fr.xephi.authme.listener.ServerListener;
import fr.xephi.authme.output.Messages;
import fr.xephi.authme.message.Messages;
import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.permission.PermissionsSystemType;
import fr.xephi.authme.security.crypts.SHA256;
@ -33,7 +33,7 @@ import fr.xephi.authme.settings.properties.SecuritySettings;
import fr.xephi.authme.task.CleanupTask;
import fr.xephi.authme.task.purge.PurgeService;
import fr.xephi.authme.service.BukkitService;
import fr.xephi.authme.geoip.GeoLiteAPI;
import fr.xephi.authme.geoip.GeoIpManager;
import fr.xephi.authme.service.MigrationService;
import fr.xephi.authme.util.PlayerUtils;
import org.bukkit.Server;
@ -74,7 +74,7 @@ public class AuthMe extends JavaPlugin {
private DataSource database;
private BukkitService bukkitService;
private Injector injector;
private GeoLiteAPI geoLiteApi;
private GeoIpManager geoIpManager;
private PlayerCache playerCache;
/**
@ -248,7 +248,7 @@ public class AuthMe extends JavaPlugin {
permsMan = injector.getSingleton(PermissionsManager.class);
bukkitService = injector.getSingleton(BukkitService.class);
commandHandler = injector.getSingleton(CommandHandler.class);
geoLiteApi = injector.getSingleton(GeoLiteAPI.class);
geoIpManager = injector.getSingleton(GeoIpManager.class);
// Trigger construction of API classes; they will keep track of the singleton
injector.getSingleton(NewAPI.class);
@ -374,7 +374,7 @@ public class AuthMe extends JavaPlugin {
.replace("{SERVER}", server.getServerName())
.replace("{VERSION}", server.getBukkitVersion())
// TODO: We should cache info like this, maybe with a class that extends Player?
.replace("{COUNTRY}", geoLiteApi.getCountryName(ipAddress));
.replace("{COUNTRY}", geoIpManager.getCountryName(ipAddress));
}

View File

@ -1,8 +1,8 @@
package fr.xephi.authme.api;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.hooks.PluginHooks;
import fr.xephi.authme.process.Management;

View File

@ -1,8 +1,8 @@
package fr.xephi.authme.api;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.hooks.PluginHooks;
import fr.xephi.authme.process.Management;

View File

@ -1,8 +1,8 @@
package fr.xephi.authme.command;
import com.github.authme.configme.properties.Property;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.service.ValidationService;
import org.bukkit.command.CommandSender;

View File

@ -1,10 +1,10 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.service.BukkitService;
import org.bukkit.command.CommandSender;

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.security.crypts.HashedPassword;
import fr.xephi.authme.service.BukkitService;

View File

@ -6,15 +6,15 @@ import com.google.common.collect.ImmutableMap;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.converter.Converter;
import fr.xephi.authme.converter.CrazyLoginConverter;
import fr.xephi.authme.converter.MySqlToSqlite;
import fr.xephi.authme.converter.RakamakConverter;
import fr.xephi.authme.converter.RoyalAuthConverter;
import fr.xephi.authme.converter.SqliteToSql;
import fr.xephi.authme.converter.vAuthConverter;
import fr.xephi.authme.converter.xAuthConverter;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.datasource.converter.Converter;
import fr.xephi.authme.datasource.converter.CrazyLoginConverter;
import fr.xephi.authme.datasource.converter.MySqlToSqlite;
import fr.xephi.authme.datasource.converter.RakamakConverter;
import fr.xephi.authme.datasource.converter.RoyalAuthConverter;
import fr.xephi.authme.datasource.converter.SqliteToSql;
import fr.xephi.authme.datasource.converter.vAuthConverter;
import fr.xephi.authme.datasource.converter.xAuthConverter;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.service.BukkitService;
import org.bukkit.command.CommandSender;

View File

@ -1,10 +1,10 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import org.bukkit.command.CommandSender;
import javax.inject.Inject;

View File

@ -1,10 +1,10 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import org.bukkit.command.CommandSender;
import javax.inject.Inject;

View File

@ -1,10 +1,10 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import org.bukkit.command.CommandSender;
import javax.inject.Inject;

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.limbo.LimboCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.security.crypts.HashedPassword;
import fr.xephi.authme.service.BukkitService;

View File

@ -8,7 +8,7 @@ import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.initialization.Reloadable;
import fr.xephi.authme.initialization.SettingsDependent;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.DatabaseSettings;
import org.bukkit.command.CommandSender;

View File

@ -1,11 +1,11 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.service.BukkitService;
import org.bukkit.command.CommandSender;

View File

@ -3,7 +3,7 @@ package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.Management;
import fr.xephi.authme.service.BukkitService;
import org.bukkit.command.CommandSender;

View File

@ -1,10 +1,10 @@
package fr.xephi.authme.command.executable.captcha;
import fr.xephi.authme.cache.CaptchaManager;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.CaptchaManager;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.PlayerCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import org.bukkit.entity.Player;
import javax.inject.Inject;

View File

@ -1,9 +1,9 @@
package fr.xephi.authme.command.executable.changepassword;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.PlayerCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.Management;
import fr.xephi.authme.service.ValidationService;
import fr.xephi.authme.service.ValidationService.ValidationResult;

View File

@ -2,7 +2,7 @@ package fr.xephi.authme.command.executable.email;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.PlayerCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.Management;
import org.bukkit.entity.Player;

View File

@ -1,13 +1,13 @@
package fr.xephi.authme.command.executable.email;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.PlayerCommand;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.mail.SendMailSSL;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.util.RandomStringUtils;
import fr.xephi.authme.security.crypts.HashedPassword;

View File

@ -4,7 +4,7 @@ import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.PlayerCommand;
import fr.xephi.authme.mail.SendMailSSL;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.Management;
import fr.xephi.authme.security.HashAlgorithm;
import fr.xephi.authme.util.RandomStringUtils;

View File

@ -1,9 +1,9 @@
package fr.xephi.authme.command.executable.unregister;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.PlayerCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.Management;
import org.bukkit.entity.Player;

View File

@ -1,4 +1,4 @@
package fr.xephi.authme.cache;
package fr.xephi.authme.data;
import fr.xephi.authme.initialization.SettingsDependent;
import fr.xephi.authme.util.RandomStringUtils;

View File

@ -1,4 +1,4 @@
package fr.xephi.authme.cache;
package fr.xephi.authme.data;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.initialization.HasCleanup;

View File

@ -1,10 +1,10 @@
package fr.xephi.authme.cache;
package fr.xephi.authme.data;
import com.google.common.annotations.VisibleForTesting;
import fr.xephi.authme.initialization.HasCleanup;
import fr.xephi.authme.initialization.SettingsDependent;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.SecuritySettings;
import fr.xephi.authme.service.BukkitService;

View File

@ -1,4 +1,4 @@
package fr.xephi.authme.cache.auth;
package fr.xephi.authme.data.auth;
import fr.xephi.authme.security.crypts.HashedPassword;
import org.bukkit.Location;

View File

@ -1,4 +1,4 @@
package fr.xephi.authme.cache.auth;
package fr.xephi.authme.data.auth;
import java.util.concurrent.ConcurrentHashMap;

View File

@ -1,4 +1,4 @@
package fr.xephi.authme.cache.backup;
package fr.xephi.authme.data.backup;
import com.google.common.io.Files;
import com.google.gson.Gson;
@ -10,7 +10,7 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.limbo.PlayerData;
import fr.xephi.authme.data.limbo.LimboPlayer;
import fr.xephi.authme.initialization.DataFolder;
import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.settings.SpawnLoader;
@ -30,7 +30,7 @@ import java.nio.charset.StandardCharsets;
/**
* Class used to store player's data (OP, flying, speed, position) to disk.
*/
public class PlayerDataStorage {
public class LimboPlayerStorage {
private final Gson gson;
private final File cacheDir;
@ -39,7 +39,7 @@ public class PlayerDataStorage {
private BukkitService bukkitService;
@Inject
PlayerDataStorage(@DataFolder File dataFolder, PermissionsManager permsMan,
LimboPlayerStorage(@DataFolder File dataFolder, PermissionsManager permsMan,
SpawnLoader spawnLoader, BukkitService bukkitService) {
this.permissionsManager = permsMan;
this.spawnLoader = spawnLoader;
@ -50,8 +50,8 @@ public class PlayerDataStorage {
ConsoleLogger.warning("Failed to create userdata directory.");
}
gson = new GsonBuilder()
.registerTypeAdapter(PlayerData.class, new PlayerDataSerializer())
.registerTypeAdapter(PlayerData.class, new PlayerDataDeserializer())
.registerTypeAdapter(LimboPlayer.class, new LimboPlayerSerializer())
.registerTypeAdapter(LimboPlayer.class, new LimboPlayerDeserializer())
.setPrettyPrinting()
.create();
}
@ -63,7 +63,7 @@ public class PlayerDataStorage {
*
* @return PlayerData object if the data is exist, null otherwise.
*/
public PlayerData readData(Player player) {
public LimboPlayer readData(Player player) {
String id = PlayerUtils.getUUIDorName(player);
File file = new File(cacheDir, id + File.separator + "data.json");
if (!file.exists()) {
@ -72,7 +72,7 @@ public class PlayerDataStorage {
try {
String str = Files.toString(file, StandardCharsets.UTF_8);
return gson.fromJson(str, PlayerData.class);
return gson.fromJson(str, LimboPlayer.class);
} catch (IOException e) {
ConsoleLogger.logException("Could not read player data on disk for '" + player.getName() + "'", e);
return null;
@ -95,12 +95,12 @@ public class PlayerDataStorage {
boolean canFly = player.getAllowFlight();
float walkSpeed = player.getWalkSpeed();
float flySpeed = player.getFlySpeed();
PlayerData playerData = new PlayerData(location, operator, group, canFly, walkSpeed, flySpeed);
LimboPlayer limboPlayer = new LimboPlayer(location, operator, group, canFly, walkSpeed, flySpeed);
try {
File file = new File(cacheDir, id + File.separator + "data.json");
Files.createParentDirs(file);
Files.touch(file);
Files.write(gson.toJson(playerData), file, StandardCharsets.UTF_8);
Files.write(gson.toJson(limboPlayer), file, StandardCharsets.UTF_8);
} catch (IOException e) {
ConsoleLogger.logException("Failed to write " + player.getName() + " data.", e);
}
@ -136,9 +136,9 @@ public class PlayerDataStorage {
return file.exists();
}
private class PlayerDataDeserializer implements JsonDeserializer<PlayerData> {
private class LimboPlayerDeserializer implements JsonDeserializer<LimboPlayer> {
@Override
public PlayerData deserialize(JsonElement jsonElement, Type type,
public LimboPlayer deserialize(JsonElement jsonElement, Type type,
JsonDeserializationContext context) {
JsonObject jsonObject = jsonElement.getAsJsonObject();
if (jsonObject == null) {
@ -181,18 +181,18 @@ public class PlayerDataStorage {
flySpeed = e.getAsFloat();
}
return new PlayerData(loc, operator, group, canFly, walkSpeed, flySpeed);
return new LimboPlayer(loc, operator, group, canFly, walkSpeed, flySpeed);
}
}
private class PlayerDataSerializer implements JsonSerializer<PlayerData> {
private class LimboPlayerSerializer implements JsonSerializer<LimboPlayer> {
@Override
public JsonElement serialize(PlayerData playerData, Type type,
public JsonElement serialize(LimboPlayer limboPlayer, Type type,
JsonSerializationContext context) {
JsonObject obj = new JsonObject();
obj.addProperty("group", playerData.getGroup());
obj.addProperty("group", limboPlayer.getGroup());
Location loc = playerData.getLocation();
Location loc = limboPlayer.getLocation();
JsonObject obj2 = new JsonObject();
obj2.addProperty("world", loc.getWorld().getName());
obj2.addProperty("x", loc.getX());
@ -202,10 +202,10 @@ public class PlayerDataStorage {
obj2.addProperty("pitch", loc.getPitch());
obj.add("location", obj2);
obj.addProperty("operator", playerData.isOperator());
obj.addProperty("can-fly", playerData.isCanFly());
obj.addProperty("walk-speed", playerData.getWalkSpeed());
obj.addProperty("fly-speed", playerData.getFlySpeed());
obj.addProperty("operator", limboPlayer.isOperator());
obj.addProperty("can-fly", limboPlayer.isCanFly());
obj.addProperty("walk-speed", limboPlayer.getWalkSpeed());
obj.addProperty("fly-speed", limboPlayer.getFlySpeed());
return obj;
}
}

View File

@ -1,6 +1,6 @@
package fr.xephi.authme.cache.limbo;
package fr.xephi.authme.data.limbo;
import fr.xephi.authme.cache.backup.PlayerDataStorage;
import fr.xephi.authme.data.backup.LimboPlayerStorage;
import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.SpawnLoader;
@ -16,24 +16,24 @@ import java.util.concurrent.ConcurrentHashMap;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Manages all {@link PlayerData} instances.
* Manages all {@link LimboPlayer} instances.
*/
public class LimboCache {
private final Map<String, PlayerData> cache = new ConcurrentHashMap<>();
private final Map<String, LimboPlayer> cache = new ConcurrentHashMap<>();
private PlayerDataStorage playerDataStorage;
private LimboPlayerStorage limboPlayerStorage;
private Settings settings;
private PermissionsManager permissionsManager;
private SpawnLoader spawnLoader;
@Inject
LimboCache(Settings settings, PermissionsManager permissionsManager,
SpawnLoader spawnLoader, PlayerDataStorage playerDataStorage) {
SpawnLoader spawnLoader, LimboPlayerStorage limboPlayerStorage) {
this.settings = settings;
this.permissionsManager = permissionsManager;
this.spawnLoader = spawnLoader;
this.playerDataStorage = playerDataStorage;
this.limboPlayerStorage = limboPlayerStorage;
}
/**
@ -53,8 +53,8 @@ public class LimboCache {
playerGroup = permissionsManager.getPrimaryGroup(player);
}
if (playerDataStorage.hasData(player)) {
PlayerData cache = playerDataStorage.readData(player);
if (limboPlayerStorage.hasData(player)) {
LimboPlayer cache = limboPlayerStorage.readData(player);
if (cache != null) {
location = cache.getLocation();
playerGroup = cache.getGroup();
@ -64,10 +64,10 @@ public class LimboCache {
flySpeed = cache.getFlySpeed();
}
} else {
playerDataStorage.saveData(player);
limboPlayerStorage.saveData(player);
}
cache.put(name, new PlayerData(location, operator, playerGroup, flyEnabled, walkSpeed, flySpeed));
cache.put(name, new LimboPlayer(location, operator, playerGroup, flyEnabled, walkSpeed, flySpeed));
}
/**
@ -78,7 +78,7 @@ public class LimboCache {
public void restoreData(Player player) {
String lowerName = player.getName().toLowerCase();
if (cache.containsKey(lowerName)) {
PlayerData data = cache.get(lowerName);
LimboPlayer data = cache.get(lowerName);
player.setOp(data.isOperator());
player.setAllowFlight(data.isCanFly());
float walkSpeed = data.getWalkSpeed();
@ -104,7 +104,7 @@ public class LimboCache {
*/
public void deletePlayerData(Player player) {
removeFromCache(player);
playerDataStorage.removeData(player);
limboPlayerStorage.removeData(player);
}
/**
@ -114,7 +114,7 @@ public class LimboCache {
*/
public void removeFromCache(Player player) {
String name = player.getName().toLowerCase();
PlayerData cachedPlayer = cache.remove(name);
LimboPlayer cachedPlayer = cache.remove(name);
if (cachedPlayer != null) {
cachedPlayer.clearTasks();
}
@ -127,7 +127,7 @@ public class LimboCache {
*
* @return PlayerData
*/
public PlayerData getPlayerData(String name) {
public LimboPlayer getPlayerData(String name) {
checkNotNull(name);
return cache.get(name.toLowerCase());
}

View File

@ -1,4 +1,4 @@
package fr.xephi.authme.cache.limbo;
package fr.xephi.authme.data.limbo;
import org.bukkit.Location;
import org.bukkit.scheduler.BukkitTask;
@ -7,7 +7,7 @@ import org.bukkit.scheduler.BukkitTask;
* Represents a player which is not logged in and keeps track of certain states (like OP status, flying)
* which may be revoked from the player until he has logged in or registered.
*/
public class PlayerData {
public class LimboPlayer {
private final boolean canFly;
private final boolean operator;
@ -18,8 +18,7 @@ public class PlayerData {
private BukkitTask timeoutTask = null;
private BukkitTask messageTask = null;
public PlayerData(Location loc, boolean operator,
String group, boolean fly, float walkSpeed, float flySpeed) {
public LimboPlayer(Location loc, boolean operator, String group, boolean fly, float walkSpeed, float flySpeed) {
this.loc = loc;
this.operator = operator;
this.group = group;

View File

@ -9,8 +9,10 @@ import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.DataSourceType;
import fr.xephi.authme.security.crypts.HashedPassword;
import java.util.ArrayList;

View File

@ -1,6 +1,6 @@
package fr.xephi.authme.datasource;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.initialization.Reloadable;
import fr.xephi.authme.security.crypts.HashedPassword;

View File

@ -7,9 +7,9 @@ public enum DataSourceType {
MYSQL,
@Deprecated
FILE,
SQLITE,
SQLITE
@Deprecated
FILE
}

View File

@ -1,8 +1,8 @@
package fr.xephi.authme.datasource;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.security.crypts.HashedPassword;
import java.io.BufferedReader;

View File

@ -4,7 +4,10 @@ import com.google.common.annotations.VisibleForTesting;
import com.zaxxer.hikari.HikariDataSource;
import com.zaxxer.hikari.pool.HikariPool.PoolInitializationException;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.Columns;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.DataSourceType;
import fr.xephi.authme.security.HashAlgorithm;
import fr.xephi.authme.security.crypts.HashedPassword;
import fr.xephi.authme.security.crypts.XFBCRYPT;

View File

@ -2,7 +2,10 @@ package fr.xephi.authme.datasource;
import com.google.common.annotations.VisibleForTesting;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.Columns;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.DataSourceType;
import fr.xephi.authme.security.crypts.HashedPassword;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.DatabaseSettings;

View File

@ -1,7 +1,7 @@
package fr.xephi.authme.converter;
package fr.xephi.authme.datasource.converter;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.DataSourceType;
import org.bukkit.command.CommandSender;

View File

@ -1,4 +1,4 @@
package fr.xephi.authme.converter;
package fr.xephi.authme.datasource.converter;
import org.bukkit.command.CommandSender;

View File

@ -1,7 +1,7 @@
package fr.xephi.authme.converter;
package fr.xephi.authme.datasource.converter;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.initialization.DataFolder;
import fr.xephi.authme.settings.Settings;

View File

@ -1,4 +1,4 @@
package fr.xephi.authme.converter;
package fr.xephi.authme.datasource.converter;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.FlatFile;

View File

@ -1,4 +1,4 @@
package fr.xephi.authme.converter;
package fr.xephi.authme.datasource.converter;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.DataSourceType;

View File

@ -1,7 +1,7 @@
package fr.xephi.authme.converter;
package fr.xephi.authme.datasource.converter;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.initialization.DataFolder;
import fr.xephi.authme.security.PasswordSecurity;

View File

@ -1,8 +1,8 @@
package fr.xephi.authme.converter;
package fr.xephi.authme.datasource.converter;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
@ -12,7 +12,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import javax.inject.Inject;
import java.io.File;
import static fr.xephi.authme.util.StringUtils.makePath;
import static fr.xephi.authme.util.FileUtils.makePath;
public class RoyalAuthConverter implements Converter {

View File

@ -1,4 +1,4 @@
package fr.xephi.authme.converter;
package fr.xephi.authme.datasource.converter;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.DataSourceType;

View File

@ -1,7 +1,7 @@
package fr.xephi.authme.converter;
package fr.xephi.authme.datasource.converter;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.initialization.DataFolder;
import org.bukkit.Bukkit;
@ -14,7 +14,7 @@ import java.io.IOException;
import java.util.Scanner;
import java.util.UUID;
import static fr.xephi.authme.util.StringUtils.makePath;
import static fr.xephi.authme.util.FileUtils.makePath;
public class vAuthConverter implements Converter {

View File

@ -1,9 +1,9 @@
package fr.xephi.authme.converter;
package fr.xephi.authme.datasource.converter;
import de.luricos.bukkit.xAuth.database.DatabaseTables;
import de.luricos.bukkit.xAuth.utils.xAuthLog;
import de.luricos.bukkit.xAuth.xAuth;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.initialization.DataFolder;
import fr.xephi.authme.util.CollectionUtils;
@ -19,7 +19,7 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import static fr.xephi.authme.util.StringUtils.makePath;
import static fr.xephi.authme.util.FileUtils.makePath;
public class xAuthConverter implements Converter {

View File

@ -17,7 +17,7 @@ import java.net.URLConnection;
import java.util.concurrent.TimeUnit;
import java.util.zip.GZIPInputStream;
public class GeoLiteAPI {
public class GeoIpManager {
private static final String LICENSE =
"[LICENSE] This product uses data from the GeoLite API created by MaxMind, available at http://www.maxmind.com";
private static final String GEOIP_URL =
@ -28,14 +28,14 @@ public class GeoLiteAPI {
private final File dataFile;
@Inject
GeoLiteAPI(@DataFolder File dataFolder) {
GeoIpManager(@DataFolder File dataFolder) {
this.dataFile = new File(dataFolder, "GeoIP.dat");
// Fires download of recent data or the initialization of the look up service
isDataAvailable();
}
@VisibleForTesting
GeoLiteAPI(@DataFolder File dataFolder, LookupService lookupService) {
GeoIpManager(@DataFolder File dataFolder, LookupService lookupService) {
this.dataFile = dataFolder;
this.lookupService = lookupService;
}

View File

@ -5,7 +5,7 @@ import com.github.authme.configme.resource.PropertyResource;
import com.github.authme.configme.resource.YamlFileResource;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.CacheDataSource;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.DataSourceType;
@ -14,8 +14,8 @@ import fr.xephi.authme.datasource.MySQL;
import fr.xephi.authme.datasource.SQLite;
import fr.xephi.authme.output.ConsoleFilter;
import fr.xephi.authme.output.Log4JFilter;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.SettingsMigrationService;
import fr.xephi.authme.settings.properties.AuthMeSettingsRetriever;

View File

@ -1,9 +1,9 @@
package fr.xephi.authme.initialization;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.cache.backup.PlayerDataStorage;
import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.data.backup.LimboPlayerStorage;
import fr.xephi.authme.data.limbo.LimboCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.hooks.PluginHooks;
import fr.xephi.authme.settings.Settings;
@ -32,7 +32,7 @@ public class OnShutdownPlayerSaver {
@Inject
private DataSource dataSource;
@Inject
private PlayerDataStorage playerDataStorage;
private LimboPlayerStorage limboPlayerStorage;
@Inject
private SpawnLoader spawnLoader;
@Inject
@ -77,8 +77,8 @@ public class OnShutdownPlayerSaver {
}
if (settings.getProperty(RestrictionSettings.TELEPORT_UNAUTHED_TO_SPAWN)
&& !settings.getProperty(RestrictionSettings.NO_TELEPORT)) {
if (!playerDataStorage.hasData(player)) {
playerDataStorage.saveData(player);
if (!limboPlayerStorage.hasData(player)) {
limboPlayerStorage.saveData(player);
}
}
}

View File

@ -1,6 +1,6 @@
package fr.xephi.authme.listener;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
/**
* Exception thrown when a verification has failed.

View File

@ -1,6 +1,6 @@
package fr.xephi.authme.listener;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.hooks.PluginHooks;
import fr.xephi.authme.initialization.SettingsDependent;

View File

@ -1,11 +1,11 @@
package fr.xephi.authme.listener;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.initialization.Reloadable;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages;
import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.permission.PlayerStatePermission;
import fr.xephi.authme.service.AntiBotService;

View File

@ -1,9 +1,9 @@
package fr.xephi.authme.listener;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages;
import fr.xephi.authme.process.Management;
import fr.xephi.authme.service.AntiBotService;
import fr.xephi.authme.settings.Settings;

View File

@ -23,7 +23,7 @@ import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerCache;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

View File

@ -3,7 +3,7 @@ package fr.xephi.authme.listener.protocollib;
import ch.jalu.injector.annotations.NoFieldScan;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.initialization.SettingsDependent;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.RestrictionSettings;

View File

@ -8,7 +8,7 @@ import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.reflect.FieldAccessException;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerCache;
class TabCompletePacketAdapter extends PacketAdapter {

View File

@ -1,4 +1,4 @@
package fr.xephi.authme.output;
package fr.xephi.authme.message;
/**
* Keys for translatable messages managed by {@link Messages}.

View File

@ -1,4 +1,4 @@
package fr.xephi.authme.output;
package fr.xephi.authme.message;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.initialization.SettingsDependent;

View File

@ -1,8 +1,8 @@
package fr.xephi.authme.permission;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.cache.limbo.PlayerData;
import fr.xephi.authme.data.limbo.LimboCache;
import fr.xephi.authme.data.limbo.LimboPlayer;
import fr.xephi.authme.initialization.Reloadable;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.HooksSettings;
@ -72,7 +72,7 @@ public class AuthGroupHandler implements Reloadable {
case LOGGED_IN:
// Get the player data
PlayerData data = limboCache.getPlayerData(player.getName().toLowerCase());
LimboPlayer data = limboCache.getPlayerData(player.getName().toLowerCase());
if (data == null) {
return false;
}

View File

@ -1,8 +1,8 @@
package fr.xephi.authme.process;
import com.github.authme.configme.properties.Property;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages;
import fr.xephi.authme.permission.AuthGroupHandler;
import fr.xephi.authme.permission.AuthGroupType;
import fr.xephi.authme.permission.PermissionNode;

View File

@ -1,10 +1,10 @@
package fr.xephi.authme.process.changepassword;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.process.ProcessService;
import fr.xephi.authme.security.PasswordSecurity;

View File

@ -1,10 +1,10 @@
package fr.xephi.authme.process.email;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.process.ProcessService;
import fr.xephi.authme.settings.properties.RegistrationSettings;

View File

@ -1,9 +1,9 @@
package fr.xephi.authme.process.email;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.process.ProcessService;
import fr.xephi.authme.settings.properties.RegistrationSettings;

View File

@ -2,14 +2,14 @@ package fr.xephi.authme.process.join;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.SessionManager;
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.data.SessionManager;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.data.limbo.LimboCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.events.ProtectInventoryEvent;
import fr.xephi.authme.hooks.PluginHooks;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.permission.AuthGroupType;
import fr.xephi.authme.permission.PlayerStatePermission;
import fr.xephi.authme.process.AsynchronousProcess;

View File

@ -2,15 +2,15 @@ package fr.xephi.authme.process.login;
import com.google.common.annotations.VisibleForTesting;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.CaptchaManager;
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.PlayerData;
import fr.xephi.authme.data.CaptchaManager;
import fr.xephi.authme.data.TempbanManager;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.data.limbo.LimboCache;
import fr.xephi.authme.data.limbo.LimboPlayer;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.events.AuthMeAsyncPreLoginEvent;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.permission.AdminPermission;
import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.permission.PlayerPermission;
@ -241,9 +241,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.
PlayerData playerData = limboCache.getPlayerData(name);
if (playerData != null) {
playerData.clearTasks();
LimboPlayer limboPlayer = limboCache.getPlayerData(name);
if (limboPlayer != null) {
limboPlayer.clearTasks();
}
syncProcessManager.processSyncPlayerLogin(player);
} else {

View File

@ -1,9 +1,9 @@
package fr.xephi.authme.process.login;
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.PlayerData;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.limbo.LimboCache;
import fr.xephi.authme.data.limbo.LimboPlayer;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.events.LoginEvent;
import fr.xephi.authme.events.RestoreInventoryEvent;
@ -79,7 +79,7 @@ public class ProcessSyncPlayerLogin implements SynchronousProcess {
public void processPlayerLogin(Player player) {
final String name = player.getName().toLowerCase();
final PlayerData limbo = limboCache.getPlayerData(name);
final LimboPlayer limbo = limboCache.getPlayerData(name);
// Limbo contains the State of the Player before /login
if (limbo != null) {
limboCache.restoreData(player);

View File

@ -1,10 +1,10 @@
package fr.xephi.authme.process.logout;
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.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.data.limbo.LimboCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.process.ProcessService;
import fr.xephi.authme.process.SyncProcessManager;

View File

@ -1,10 +1,10 @@
package fr.xephi.authme.process.logout;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.SessionManager;
import fr.xephi.authme.data.SessionManager;
import fr.xephi.authme.events.LogoutEvent;
import fr.xephi.authme.listener.protocollib.ProtocolLibService;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.permission.AuthGroupType;
import fr.xephi.authme.process.ProcessService;
import fr.xephi.authme.process.SynchronousProcess;

View File

@ -1,9 +1,9 @@
package fr.xephi.authme.process.quit;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.SessionManager;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.SessionManager;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.CacheDataSource;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.process.AsynchronousProcess;

View File

@ -1,7 +1,7 @@
package fr.xephi.authme.process.quit;
import fr.xephi.authme.cache.backup.PlayerDataStorage;
import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.data.backup.LimboPlayerStorage;
import fr.xephi.authme.data.limbo.LimboCache;
import fr.xephi.authme.process.SynchronousProcess;
import org.bukkit.entity.Player;
@ -11,7 +11,7 @@ import javax.inject.Inject;
public class ProcessSyncronousPlayerQuit implements SynchronousProcess {
@Inject
private PlayerDataStorage playerDataStorage;
private LimboPlayerStorage limboPlayerStorage;
@Inject
private LimboCache limboCache;
@ -22,8 +22,8 @@ public class ProcessSyncronousPlayerQuit implements SynchronousProcess {
limboCache.removeFromCache(player);
} else {
// Save player's data, so we could retrieve it later on player next join
if (!playerDataStorage.hasData(player)) {
playerDataStorage.saveData(player);
if (!limboPlayerStorage.hasData(player)) {
limboPlayerStorage.saveData(player);
}
}

View File

@ -1,10 +1,10 @@
package fr.xephi.authme.process.register;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.mail.SendMailSSL;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.process.ProcessService;

View File

@ -1,7 +1,7 @@
package fr.xephi.authme.process.register;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.permission.AuthGroupType;
import fr.xephi.authme.process.ProcessService;
import fr.xephi.authme.process.SynchronousProcess;

View File

@ -1,8 +1,8 @@
package fr.xephi.authme.process.register;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.data.limbo.LimboCache;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.permission.AuthGroupType;
import fr.xephi.authme.process.ProcessService;
import fr.xephi.authme.process.SynchronousProcess;

View File

@ -1,11 +1,11 @@
package fr.xephi.authme.process.unregister;
import fr.xephi.authme.ConsoleLogger;
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.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.data.limbo.LimboCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.permission.AuthGroupHandler;
import fr.xephi.authme.permission.AuthGroupType;
import fr.xephi.authme.process.AsynchronousProcess;

View File

@ -1,8 +1,8 @@
package fr.xephi.authme.service;
import fr.xephi.authme.initialization.SettingsDependent;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages;
import fr.xephi.authme.permission.AdminPermission;
import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.settings.Settings;

View File

@ -1,8 +1,8 @@
package fr.xephi.authme.service;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.converter.ForceFlatToSqlite;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.converter.ForceFlatToSqlite;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.DataSourceType;
import fr.xephi.authme.datasource.FlatFile;

View File

@ -1,8 +1,8 @@
package fr.xephi.authme.service;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.cache.limbo.PlayerData;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.data.limbo.LimboPlayer;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.events.AbstractTeleportEvent;
import fr.xephi.authme.events.AuthMeTeleportEvent;
@ -101,7 +101,7 @@ public class TeleportationService implements Reloadable {
* @param auth corresponding PlayerAuth object
* @param limbo corresponding PlayerData object
*/
public void teleportOnLogin(final Player player, PlayerAuth auth, PlayerData limbo) {
public void teleportOnLogin(final Player player, PlayerAuth auth, LimboPlayer limbo) {
if (settings.getProperty(RestrictionSettings.NO_TELEPORT)) {
return;
}

View File

@ -2,9 +2,9 @@ package fr.xephi.authme.service;
import com.github.authme.configme.properties.Property;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.geoip.GeoLiteAPI;
import fr.xephi.authme.geoip.GeoIpManager;
import fr.xephi.authme.initialization.Reloadable;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.permission.PlayerStatePermission;
import fr.xephi.authme.settings.Settings;
@ -36,7 +36,7 @@ public class ValidationService implements Reloadable {
@Inject
private PermissionsManager permissionsManager;
@Inject
private GeoLiteAPI geoLiteApi;
private GeoIpManager geoIpManager;
private Pattern passwordRegex;
private Set<String> unrestrictedNames;
@ -115,7 +115,7 @@ public class ValidationService implements Reloadable {
return true;
}
String countryCode = geoLiteApi.getCountryCode(hostAddress);
String countryCode = geoIpManager.getCountryCode(hostAddress);
return validateWhitelistAndBlacklist(countryCode,
ProtectionSettings.COUNTRIES_WHITELIST,
ProtectionSettings.COUNTRIES_BLACKLIST);

View File

@ -7,7 +7,7 @@ import com.github.authme.configme.resource.PropertyResource;
import com.google.common.io.Files;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.settings.properties.PluginSettings;
import fr.xephi.authme.util.StringUtils;
import fr.xephi.authme.util.FileUtils;
import java.io.File;
import java.io.IOException;
@ -120,7 +120,7 @@ public class Settings extends SettingsManager {
}
private static String buildMessagesFilePathFromCode(String language) {
return StringUtils.makePath("messages", "messages_" + language + ".yml");
return FileUtils.makePath("messages", "messages_" + language + ".yml");
}
/**

View File

@ -1,7 +1,7 @@
package fr.xephi.authme.task;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.data.limbo.LimboCache;
import fr.xephi.authme.service.BukkitService;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitTask;

View File

@ -1,11 +1,11 @@
package fr.xephi.authme.task;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.cache.limbo.PlayerData;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.data.limbo.LimboCache;
import fr.xephi.authme.data.limbo.LimboPlayer;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.RegistrationSettings;
import fr.xephi.authme.settings.properties.RestrictionSettings;
@ -52,14 +52,14 @@ public class PlayerDataTaskManager {
final int interval = settings.getProperty(RegistrationSettings.MESSAGE_INTERVAL);
final MessageKey key = getMessageKey(isRegistered);
if (interval > 0) {
final PlayerData playerData = limboCache.getPlayerData(name);
if (playerData == null) {
final LimboPlayer limboPlayer = limboCache.getPlayerData(name);
if (limboPlayer == null) {
ConsoleLogger.info("PlayerData for '" + name + "' is not available");
} else {
cancelTask(playerData.getMessageTask());
cancelTask(limboPlayer.getMessageTask());
BukkitTask messageTask = bukkitService.runTask(new MessageTask(name, messages.retrieve(key),
interval, bukkitService, limboCache, playerCache));
playerData.setMessageTask(messageTask);
limboPlayer.setMessageTask(messageTask);
}
}
}
@ -72,14 +72,14 @@ public class PlayerDataTaskManager {
public void registerTimeoutTask(Player player) {
final int timeout = settings.getProperty(RestrictionSettings.TIMEOUT) * TICKS_PER_SECOND;
if (timeout > 0) {
final PlayerData playerData = limboCache.getPlayerData(player.getName());
if (playerData == null) {
final LimboPlayer limboPlayer = limboCache.getPlayerData(player.getName());
if (limboPlayer == null) {
ConsoleLogger.info("PlayerData for '" + player.getName() + "' is not available");
} else {
cancelTask(playerData.getTimeoutTask());
cancelTask(limboPlayer.getTimeoutTask());
String message = messages.retrieveSingle(MessageKey.LOGIN_TIMEOUT_ERROR);
BukkitTask task = bukkitService.runTaskLater(new TimeoutTask(player, message, playerCache), timeout);
playerData.setTimeoutTask(task);
limboPlayer.setTimeoutTask(task);
}
}
}

View File

@ -1,6 +1,6 @@
package fr.xephi.authme.task;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerCache;
import org.bukkit.entity.Player;
/**

View File

@ -16,7 +16,7 @@ import javax.inject.Inject;
import java.io.File;
import java.util.Collection;
import static fr.xephi.authme.util.StringUtils.makePath;
import static fr.xephi.authme.util.FileUtils.makePath;
/**
* Executes the purge operations.

View File

@ -16,6 +16,8 @@ import java.util.Calendar;
import java.util.Collection;
import java.util.Set;
// TODO: move into services. -sgdc3
/**
* Initiates purge tasks.
*/

View File

@ -87,4 +87,15 @@ public final class FileUtils {
}
}
}
/**
* Construct a file path from the given elements, i.e. separate the given elements by the file separator.
*
* @param elements The elements to create a path with
*
* @return The created path
*/
public static String makePath(String... elements) {
return String.join(File.separator, elements);
}
}

View File

@ -78,16 +78,4 @@ public final class StringUtils {
public static String formatException(Throwable th) {
return "[" + th.getClass().getSimpleName() + "]: " + th.getMessage();
}
/**
* Construct a file path from the given elements, i.e. separate the given elements by the file separator.
*
* @param elements The elements to create a path with
*
* @return The created path
*/
public static String makePath(String... elements) {
return String.join(File.separator, elements);
}
}

View File

@ -1,6 +1,6 @@
package fr.xephi.authme;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.security.crypts.HashedPassword;
import org.hamcrest.Description;
import org.hamcrest.Matcher;

View File

@ -2,8 +2,8 @@ package fr.xephi.authme.api;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ReflectionTestUtils;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.hooks.PluginHooks;
import fr.xephi.authme.process.Management;

View File

@ -1,8 +1,8 @@
package fr.xephi.authme.command;
import com.github.authme.configme.properties.Property;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.SecuritySettings;
import fr.xephi.authme.service.ValidationService;

View File

@ -1,9 +1,9 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.service.BukkitService;
import org.bukkit.command.CommandSender;
import org.junit.Test;

View File

@ -1,11 +1,11 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.TestHelper;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.security.crypts.HashedPassword;
import fr.xephi.authme.service.BukkitService;

View File

@ -3,8 +3,8 @@ package fr.xephi.authme.command.executable.authme;
import ch.jalu.injector.Injector;
import fr.xephi.authme.TestHelper;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.converter.Converter;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.datasource.converter.Converter;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.service.BukkitService;
import fr.xephi.authme.util.StringUtils;
import org.bukkit.command.CommandSender;

View File

@ -1,9 +1,9 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import org.bukkit.command.CommandSender;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,9 +1,9 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import org.bukkit.command.CommandSender;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,9 +1,9 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import org.bukkit.command.CommandSender;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,11 +1,11 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.TestHelper;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.limbo.LimboCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.security.crypts.HashedPassword;
import fr.xephi.authme.service.BukkitService;

View File

@ -9,7 +9,7 @@ import fr.xephi.authme.datasource.DataSourceType;
import fr.xephi.authme.initialization.Reloadable;
import fr.xephi.authme.initialization.SettingsDependent;
import fr.xephi.authme.output.LogLevel;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.DatabaseSettings;
import fr.xephi.authme.settings.properties.PluginSettings;

View File

@ -1,10 +1,10 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.service.BukkitService;
import org.bukkit.command.CommandSender;
import org.junit.Test;

View File

@ -2,7 +2,7 @@ package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.Management;
import fr.xephi.authme.service.BukkitService;
import org.bukkit.command.CommandSender;

View File

@ -1,9 +1,9 @@
package fr.xephi.authme.command.executable.captcha;
import fr.xephi.authme.cache.CaptchaManager;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.CaptchaManager;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import org.bukkit.entity.Player;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,8 +1,8 @@
package fr.xephi.authme.command.executable.changepassword;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.Management;
import fr.xephi.authme.settings.properties.RestrictionSettings;
import fr.xephi.authme.settings.properties.SecuritySettings;

View File

@ -1,7 +1,7 @@
package fr.xephi.authme.command.executable.email;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.Management;
import org.bukkit.command.BlockCommandSender;
import org.bukkit.command.CommandSender;

Some files were not shown because too many files have changed in this diff Show More