mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-25 10:07:35 +01:00
commit
925e78e860
59
pom.xml
59
pom.xml
@ -116,31 +116,19 @@
|
||||
<!-- SpigotMC Repo (Bukkit and SpigotAPI) -->
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
|
||||
<!-- Mcstats.org Metrics Repo -->
|
||||
<repository>
|
||||
<id>Plugin Metrics</id>
|
||||
<url>http://repo.mcstats.org/content/repositories/releases</url>
|
||||
</repository>
|
||||
|
||||
<!-- Vault Repo -->
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
|
||||
<!-- Citizens 2.X Repo -->
|
||||
<repository>
|
||||
<id>citizens-repo</id>
|
||||
<url>http://repo.citizensnpcs.co</url>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public</url>
|
||||
</repository>
|
||||
|
||||
<!-- Essentials Repo -->
|
||||
<repository>
|
||||
<id>ess-repo</id>
|
||||
<url>http://repo.ess3.net/content/groups/essentials</url>
|
||||
<url>http://repo.ess3.net/content/groups/public</url>
|
||||
</repository>
|
||||
|
||||
<!-- Citizens API 2.X Repo -->
|
||||
<repository>
|
||||
<id>citizensapi-repo</id>
|
||||
<url>http://ci.citizensnpcs.co/plugin/repository/project/CitizensAPI/LastSuccessful/repository</url>
|
||||
</repository>
|
||||
|
||||
<!-- CombatTagPlus Repo -->
|
||||
@ -149,22 +137,34 @@
|
||||
<url>http://repo.minelink.net/content/repositories/public</url>
|
||||
</repository>
|
||||
|
||||
<!-- XAuth Repo -->
|
||||
<repository>
|
||||
<id>luricos-releases</id>
|
||||
<url>http://repo.luricos.de/content/repositories/bukkit-plugins</url>
|
||||
</repository>
|
||||
|
||||
<!-- Attribute Repo -->
|
||||
<repository>
|
||||
<id>comphenix-snapshots</id>
|
||||
<url>http://repo.comphenix.net/content/repositories/snapshots</url>
|
||||
<url>http://repo.comphenix.net/content/repositories/public</url>
|
||||
</repository>
|
||||
|
||||
<!-- Multiverse Repo -->
|
||||
<repository>
|
||||
<id>onarandombox</id>
|
||||
<url>http://repo.onarandombox.com/content/repositories/multiverse</url>
|
||||
<url>http://repo.onarandombox.com/content/groups/public</url>
|
||||
</repository>
|
||||
|
||||
<!-- Vault Repo -->
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
|
||||
<!-- Mcstats.org Metrics Repo -->
|
||||
<repository>
|
||||
<id>Plugin Metrics</id>
|
||||
<url>http://repo.mcstats.org/content/repositories/releases</url>
|
||||
</repository>
|
||||
|
||||
<!-- XAuth Repo -->
|
||||
<repository>
|
||||
<id>luricos-releases</id>
|
||||
<url>http://repo.luricos.de/content/repositories/releases</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
@ -248,6 +248,7 @@
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.5</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
@ -300,7 +301,7 @@
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>Essentials</artifactId>
|
||||
<version>2.13-SNAPSHOT</version>
|
||||
<version>2.14-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
|
@ -12,8 +12,6 @@ import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Logger;
|
||||
@ -80,7 +78,6 @@ public class AuthMe extends JavaPlugin {
|
||||
public DataSource database = null;
|
||||
private Settings settings;
|
||||
private Messages m;
|
||||
public PlayersLogs pllog;
|
||||
public OtherAccounts otherAccounts;
|
||||
public static Server server;
|
||||
public static Logger authmeLogger = Logger.getLogger("AuthMe");
|
||||
@ -97,9 +94,9 @@ public class AuthMe extends JavaPlugin {
|
||||
public Essentials ess;
|
||||
public API api;
|
||||
public Management management;
|
||||
public HashMap<String, Integer> captcha = new HashMap<String, Integer>();
|
||||
public HashMap<String, String> cap = new HashMap<String, String>();
|
||||
public HashMap<String, String> realIp = new HashMap<String, String>();
|
||||
public ConcurrentHashMap<String, Integer> captcha = new ConcurrentHashMap<String, Integer>();
|
||||
public ConcurrentHashMap<String, String> cap = new ConcurrentHashMap<String, String>();
|
||||
public ConcurrentHashMap<String, String> realIp = new ConcurrentHashMap<String, String>();
|
||||
public MultiverseCore multiverse = null;
|
||||
public Location essentialsSpawn;
|
||||
public LookupService ls = null;
|
||||
@ -151,8 +148,6 @@ public class AuthMe extends JavaPlugin {
|
||||
|
||||
m = Messages.getInstance();
|
||||
|
||||
pllog = PlayersLogs.getInstance();
|
||||
|
||||
otherAccounts = OtherAccounts.getInstance();
|
||||
|
||||
server = getServer();
|
||||
@ -208,13 +203,13 @@ public class AuthMe extends JavaPlugin {
|
||||
|
||||
setupDatabase();
|
||||
|
||||
dataManager = new DataManager(this, database);
|
||||
dataManager = new DataManager(this);
|
||||
|
||||
// Setup API
|
||||
api = new API(this, database);
|
||||
api = new API(this);
|
||||
|
||||
// Setup Management
|
||||
management = new Management(database, this);
|
||||
management = new Management(this);
|
||||
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
if (Settings.bungee) {
|
||||
@ -222,33 +217,34 @@ public class AuthMe extends JavaPlugin {
|
||||
Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeCordMessage(this));
|
||||
}
|
||||
|
||||
pm.registerEvents(new AuthMePlayerListener(this, database), this);
|
||||
pm.registerEvents(new AuthMeBlockListener(database, this), this);
|
||||
pm.registerEvents(new AuthMeEntityListener(database, this), this);
|
||||
pm.registerEvents(new AuthMePlayerListener(this), this);
|
||||
pm.registerEvents(new AuthMeBlockListener(this), this);
|
||||
pm.registerEvents(new AuthMeEntityListener(this), this);
|
||||
pm.registerEvents(new AuthMeServerListener(this), this);
|
||||
if (ChestShop != 0) {
|
||||
pm.registerEvents(new AuthMeChestShopListener(database, this), this);
|
||||
pm.registerEvents(new AuthMeChestShopListener(this), this);
|
||||
ConsoleLogger.info("Successfully hook with ChestShop!");
|
||||
}
|
||||
|
||||
this.getCommand("authme").setExecutor(new AdminCommand(this, database));
|
||||
this.getCommand("authme").setExecutor(new AdminCommand(this));
|
||||
this.getCommand("register").setExecutor(new RegisterCommand(this));
|
||||
this.getCommand("login").setExecutor(new LoginCommand(this));
|
||||
this.getCommand("changepassword").setExecutor(new ChangePasswordCommand(database, this));
|
||||
this.getCommand("logout").setExecutor(new LogoutCommand(this, database));
|
||||
this.getCommand("unregister").setExecutor(new UnregisterCommand(this, database));
|
||||
this.getCommand("changepassword").setExecutor(new ChangePasswordCommand(this));
|
||||
this.getCommand("logout").setExecutor(new LogoutCommand(this));
|
||||
this.getCommand("unregister").setExecutor(new UnregisterCommand(this));
|
||||
this.getCommand("passpartu").setExecutor(new PasspartuCommand(this));
|
||||
this.getCommand("email").setExecutor(new EmailCommand(this, database));
|
||||
this.getCommand("email").setExecutor(new EmailCommand(this));
|
||||
this.getCommand("captcha").setExecutor(new CaptchaCommand(this));
|
||||
this.getCommand("converter").setExecutor(new ConverterCommand(this, database));
|
||||
this.getCommand("converter").setExecutor(new ConverterCommand(this));
|
||||
|
||||
if (!Settings.isForceSingleSessionEnabled) {
|
||||
ConsoleLogger.showError("BECAREFUL !!! By disabling ForceSingleSession, your server protection is set to LOW");
|
||||
}
|
||||
|
||||
PlayersLogs.getInstance();
|
||||
|
||||
if (Settings.reloadSupport)
|
||||
try {
|
||||
onReload();
|
||||
int playersOnline = 0;
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class)
|
||||
@ -261,7 +257,7 @@ public class AuthMe extends JavaPlugin {
|
||||
database.purgeLogged();
|
||||
} catch (NullPointerException npe) {
|
||||
}
|
||||
}
|
||||
} else PlayersLogs.getInstance().loadPlayers();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
|
||||
@ -432,27 +428,6 @@ public class AuthMe extends JavaPlugin {
|
||||
ConsoleLogger.info("Authme " + this.getDescription().getVersion() + " disabled");
|
||||
}
|
||||
|
||||
private void onReload() {
|
||||
try {
|
||||
if (Bukkit.getServer().getOnlinePlayers() != null) {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (database.isLogged(player.getName().toLowerCase())) {
|
||||
String name = player.getName().toLowerCase();
|
||||
PlayerAuth pAuth = database.getAuth(name);
|
||||
if (pAuth == null)
|
||||
break;
|
||||
PlayerAuth auth = new PlayerAuth(name, pAuth.getHash(), pAuth.getIp(), new Date().getTime(), pAuth.getEmail());
|
||||
database.updateSession(auth);
|
||||
PlayerCache.getInstance().addPlayer(auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
} catch (Exception ex) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static AuthMe getInstance() {
|
||||
return authme;
|
||||
}
|
||||
@ -607,7 +582,7 @@ public class AuthMe extends JavaPlugin {
|
||||
return Spawn.getInstance().getFirstSpawn();
|
||||
if (Spawn.getInstance().getSpawn() != null)
|
||||
return Spawn.getInstance().getSpawn();
|
||||
return this.getServer().getWorld(Settings.defaultWorld).getSpawnLocation();
|
||||
return player.getWorld().getSpawnLocation();
|
||||
}
|
||||
|
||||
public void downloadGeoIp() {
|
||||
|
@ -8,23 +8,19 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
|
||||
public class DataManager {
|
||||
|
||||
public AuthMe plugin;
|
||||
public DataSource database;
|
||||
|
||||
public DataManager(AuthMe plugin, DataSource database) {
|
||||
public DataManager(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
|
@ -43,4 +43,8 @@ public class PlayerCache {
|
||||
return cache.size();
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<String, PlayerAuth> getCache() {
|
||||
return this.cache;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -234,23 +234,22 @@ public class AdminCommand implements CommandExecutor {
|
||||
});
|
||||
return true;
|
||||
} else {
|
||||
final CommandSender fSender = sender;
|
||||
final String[] arguments = args;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
String message = "[AuthMe] ";
|
||||
if (args[1] == null) {
|
||||
sender.sendMessage("[AuthMe] Please put a valid IP");
|
||||
if (arguments[1] != null) {
|
||||
List<String> accountList = plugin.database.getAllAuthsByIp(arguments[1]);
|
||||
if (accountList.isEmpty() || accountList == null) {
|
||||
fSender.sendMessage("[AuthMe] Please put a valid IP");
|
||||
return;
|
||||
}
|
||||
List<String> accountList = plugin.database.getAllAuthsByIp(args[1]);
|
||||
if (accountList.isEmpty() || accountList == null) {
|
||||
sender.sendMessage("[AuthMe] This IP does not exist in the database");
|
||||
return true;
|
||||
}
|
||||
if (accountList.size() == 1) {
|
||||
sender.sendMessage("[AuthMe] " + args[1] + " is a single account player");
|
||||
return true;
|
||||
fSender.sendMessage("[AuthMe] " + arguments[1] + " is a single account player");
|
||||
return;
|
||||
}
|
||||
int i = 0;
|
||||
for (String account : accountList) {
|
||||
@ -262,8 +261,12 @@ public class AdminCommand implements CommandExecutor {
|
||||
message = message + ".";
|
||||
}
|
||||
}
|
||||
sender.sendMessage("[AuthMe] " + args[1] + " has " + String.valueOf(accountList.size()) + " accounts");
|
||||
sender.sendMessage(message);
|
||||
fSender.sendMessage("[AuthMe] " + arguments[1] + " has " + String.valueOf(accountList.size()) + " accounts");
|
||||
fSender.sendMessage(message);
|
||||
} else {
|
||||
fSender.sendMessage("[AuthMe] Please put a valid IP");
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
|
@ -16,18 +16,15 @@ import fr.xephi.authme.converter.RoyalAuthConverter;
|
||||
import fr.xephi.authme.converter.SqlToFlat;
|
||||
import fr.xephi.authme.converter.vAuthConverter;
|
||||
import fr.xephi.authme.converter.xAuthConverter;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
|
||||
public class ConverterCommand implements CommandExecutor {
|
||||
|
||||
private AuthMe plugin;
|
||||
private Messages m = Messages.getInstance();
|
||||
private DataSource database;
|
||||
|
||||
public ConverterCommand(AuthMe plugin, DataSource database) {
|
||||
public ConverterCommand(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -61,22 +58,22 @@ public class ConverterCommand implements CommandExecutor {
|
||||
converter = new FlatToSqlite(sender);
|
||||
break;
|
||||
case xauth:
|
||||
converter = new xAuthConverter(plugin, database, sender);
|
||||
converter = new xAuthConverter(plugin, sender);
|
||||
break;
|
||||
case crazylogin:
|
||||
converter = new CrazyLoginConverter(plugin, database, sender);
|
||||
converter = new CrazyLoginConverter(plugin, sender);
|
||||
break;
|
||||
case rakamak:
|
||||
converter = new RakamakConverter(plugin, database, sender);
|
||||
converter = new RakamakConverter(plugin, sender);
|
||||
break;
|
||||
case royalauth:
|
||||
converter = new RoyalAuthConverter(plugin);
|
||||
break;
|
||||
case vauth:
|
||||
converter = new vAuthConverter(plugin, database, sender);
|
||||
converter = new vAuthConverter(plugin, sender);
|
||||
break;
|
||||
case sqltoflat:
|
||||
converter = new SqlToFlat(plugin, database, sender);
|
||||
converter = new SqlToFlat(plugin, sender);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -11,7 +11,6 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.security.RandomString;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
@ -24,12 +23,10 @@ import fr.xephi.authme.settings.Settings;
|
||||
public class EmailCommand implements CommandExecutor {
|
||||
|
||||
public AuthMe plugin;
|
||||
private DataSource data;
|
||||
private Messages m = Messages.getInstance();
|
||||
|
||||
public EmailCommand(AuthMe plugin, DataSource data) {
|
||||
public EmailCommand(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -60,7 +57,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
if (Settings.getmaxRegPerEmail > 0) {
|
||||
if (!plugin.authmePermissible(sender, "authme.allow2accounts") && data.getAllAuthsByEmail(args[1]).size() >= Settings.getmaxRegPerEmail) {
|
||||
if (!plugin.authmePermissible(sender, "authme.allow2accounts") && plugin.database.getAllAuthsByEmail(args[1]).size() >= Settings.getmaxRegPerEmail) {
|
||||
m.send(player, "max_reg");
|
||||
return true;
|
||||
}
|
||||
@ -76,7 +73,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
auth.setEmail(args[1]);
|
||||
if (!data.updateEmail(auth)) {
|
||||
if (!plugin.database.updateEmail(auth)) {
|
||||
m.send(player, "error");
|
||||
return true;
|
||||
}
|
||||
@ -86,7 +83,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
} else if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
m.send(player, "email_confirm");
|
||||
} else {
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
m.send(player, "reg_email_msg");
|
||||
@ -98,7 +95,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
if (Settings.getmaxRegPerEmail > 0) {
|
||||
if (!plugin.authmePermissible(sender, "authme.allow2accounts") && data.getAllAuthsByEmail(args[2]).size() >= Settings.getmaxRegPerEmail) {
|
||||
if (!plugin.authmePermissible(sender, "authme.allow2accounts") && plugin.database.getAllAuthsByEmail(args[2]).size() >= Settings.getmaxRegPerEmail) {
|
||||
m.send(player, "max_reg");
|
||||
return true;
|
||||
}
|
||||
@ -118,7 +115,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
auth.setEmail(args[2]);
|
||||
if (!data.updateEmail(auth)) {
|
||||
if (!plugin.database.updateEmail(auth)) {
|
||||
m.send(player, "error");
|
||||
return true;
|
||||
}
|
||||
@ -128,7 +125,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
} else if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
m.send(player, "email_confirm");
|
||||
} else {
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
m.send(player, "reg_email_msg");
|
||||
@ -144,7 +141,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
m.send(player, "error");
|
||||
return true;
|
||||
}
|
||||
if (data.isAuthAvailable(name)) {
|
||||
if (plugin.database.isAuthAvailable(name)) {
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
m.send(player, "logged_in");
|
||||
return true;
|
||||
@ -156,8 +153,8 @@ public class EmailCommand implements CommandExecutor {
|
||||
PlayerAuth auth = null;
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
auth = PlayerCache.getInstance().getAuth(name);
|
||||
} else if (data.isAuthAvailable(name)) {
|
||||
auth = data.getAuth(name);
|
||||
} else if (plugin.database.isAuthAvailable(name)) {
|
||||
auth = plugin.database.getAuth(name);
|
||||
} else {
|
||||
m.send(player, "unknown_user");
|
||||
return true;
|
||||
@ -172,7 +169,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
auth.setHash(hashnew);
|
||||
data.updatePassword(auth);
|
||||
plugin.database.updatePassword(auth);
|
||||
plugin.mail.main(auth, thePass);
|
||||
m.send(player, "email_send");
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
|
@ -6,23 +6,15 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.Utils;
|
||||
import fr.xephi.authme.cache.backup.FileCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
|
||||
public class LogoutCommand implements CommandExecutor {
|
||||
|
||||
private Messages m = Messages.getInstance();
|
||||
private AuthMe plugin;
|
||||
private DataSource database;
|
||||
private Utils utils = Utils.getInstance();
|
||||
private FileCache playerBackup;
|
||||
|
||||
public LogoutCommand(AuthMe plugin, DataSource database) {
|
||||
public LogoutCommand(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
this.playerBackup = new FileCache(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,7 +20,6 @@ import fr.xephi.authme.Utils.groupType;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.cache.backup.FileCache;
|
||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.events.SpawnTeleportEvent;
|
||||
import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
@ -32,12 +31,10 @@ public class UnregisterCommand implements CommandExecutor {
|
||||
|
||||
private Messages m = Messages.getInstance();
|
||||
public AuthMe plugin;
|
||||
private DataSource database;
|
||||
private FileCache playerCache;
|
||||
|
||||
public UnregisterCommand(AuthMe plugin, DataSource database) {
|
||||
public UnregisterCommand(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
this.playerCache = new FileCache(plugin);
|
||||
}
|
||||
|
||||
@ -67,7 +64,7 @@ public class UnregisterCommand implements CommandExecutor {
|
||||
}
|
||||
try {
|
||||
if (PasswordSecurity.comparePasswordWithHash(args[0], PlayerCache.getInstance().getAuth(name).getHash(), player.getName())) {
|
||||
if (!database.removeAuth(name)) {
|
||||
if (!plugin.database.removeAuth(name)) {
|
||||
player.sendMessage("error");
|
||||
return true;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
@ -23,10 +24,9 @@ public class CrazyLoginConverter implements Converter {
|
||||
public DataSource database;
|
||||
public CommandSender sender;
|
||||
|
||||
public CrazyLoginConverter(AuthMe instance, DataSource database,
|
||||
CommandSender sender) {
|
||||
public CrazyLoginConverter(AuthMe instance, CommandSender sender) {
|
||||
this.instance = instance;
|
||||
this.database = database;
|
||||
this.database = instance.database;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
|
@ -29,10 +29,9 @@ public class RakamakConverter implements Converter {
|
||||
public DataSource database;
|
||||
public CommandSender sender;
|
||||
|
||||
public RakamakConverter(AuthMe instance, DataSource database,
|
||||
CommandSender sender) {
|
||||
public RakamakConverter(AuthMe instance, CommandSender sender) {
|
||||
this.instance = instance;
|
||||
this.database = database;
|
||||
this.database = instance.database;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
|
@ -17,9 +17,9 @@ public class SqlToFlat implements Converter {
|
||||
public DataSource database;
|
||||
public CommandSender sender;
|
||||
|
||||
public SqlToFlat(AuthMe plugin, DataSource database, CommandSender sender) {
|
||||
public SqlToFlat(AuthMe plugin, CommandSender sender) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
this.database = plugin.database;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
|
@ -12,17 +12,16 @@ public class vAuthConverter implements Converter {
|
||||
public DataSource database;
|
||||
public CommandSender sender;
|
||||
|
||||
public vAuthConverter(AuthMe plugin, DataSource database,
|
||||
CommandSender sender) {
|
||||
public vAuthConverter(AuthMe plugin, CommandSender sender) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
this.database = plugin.database;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
new vAuthFileReader(plugin, database, sender).convert();
|
||||
new vAuthFileReader(plugin, sender).convert();
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(e.getMessage());
|
||||
ConsoleLogger.showError(e.getMessage());
|
||||
|
@ -19,10 +19,9 @@ public class vAuthFileReader {
|
||||
public DataSource database;
|
||||
public CommandSender sender;
|
||||
|
||||
public vAuthFileReader(AuthMe plugin, DataSource database,
|
||||
CommandSender sender) {
|
||||
public vAuthFileReader(AuthMe plugin, CommandSender sender) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
this.database = plugin.database;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
|
@ -3,18 +3,14 @@ package fr.xephi.authme.converter;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
|
||||
public class xAuthConverter implements Converter {
|
||||
|
||||
public AuthMe plugin;
|
||||
public DataSource database;
|
||||
public CommandSender sender;
|
||||
|
||||
public xAuthConverter(AuthMe plugin, DataSource database,
|
||||
CommandSender sender) {
|
||||
public xAuthConverter(AuthMe plugin, CommandSender sender) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
@ -22,7 +18,7 @@ public class xAuthConverter implements Converter {
|
||||
public void run() {
|
||||
try {
|
||||
Class.forName("de.luricos.bukkit.xAuth.xAuth");
|
||||
xAuthToFlat converter = new xAuthToFlat(plugin, database, sender);
|
||||
xAuthToFlat converter = new xAuthToFlat(plugin, sender);
|
||||
converter.convert();
|
||||
} catch (ClassNotFoundException ce) {
|
||||
sender.sendMessage("xAuth has not been found, please put xAuth.jar in your plugin folder and restart!");
|
||||
|
@ -9,16 +9,14 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.Utils;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
public class AuthMeBlockListener implements Listener {
|
||||
|
||||
private DataSource data;
|
||||
public AuthMe instance;
|
||||
|
||||
public AuthMeBlockListener(DataSource data, AuthMe instance) {
|
||||
this.data = data;
|
||||
public AuthMeBlockListener(AuthMe instance) {
|
||||
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
@ -39,7 +37,7 @@ public class AuthMeBlockListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -64,7 +62,7 @@ public class AuthMeBlockListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
|
@ -11,16 +11,13 @@ import com.Acrobot.ChestShop.Events.PreTransactionEvent.TransactionOutcome;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.Utils;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
public class AuthMeChestShopListener implements Listener {
|
||||
|
||||
public DataSource database;
|
||||
public AuthMe plugin;
|
||||
|
||||
public AuthMeChestShopListener(DataSource database, AuthMe plugin) {
|
||||
this.database = database;
|
||||
public AuthMeChestShopListener(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@ -41,7 +38,7 @@ public class AuthMeChestShopListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!database.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
|
@ -15,17 +15,14 @@ import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.Utils;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.plugin.manager.CombatTagComunicator;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
public class AuthMeEntityListener implements Listener {
|
||||
|
||||
private DataSource data;
|
||||
public AuthMe instance;
|
||||
|
||||
public AuthMeEntityListener(DataSource data, AuthMe instance) {
|
||||
this.data = data;
|
||||
public AuthMeEntityListener(AuthMe instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
@ -57,7 +54,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -89,7 +86,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -117,7 +114,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -147,7 +144,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -178,7 +175,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -212,7 +209,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -244,7 +241,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ 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.datasource.DataSource;
|
||||
import fr.xephi.authme.plugin.manager.CombatTagComunicator;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
@ -54,13 +53,11 @@ public class AuthMePlayerListener implements Listener {
|
||||
public static ConcurrentHashMap<String, String> joinMessage = new ConcurrentHashMap<String, String>();
|
||||
private Messages m = Messages.getInstance();
|
||||
public AuthMe plugin;
|
||||
private DataSource data;
|
||||
public static ConcurrentHashMap<String, Boolean> causeByAuthMe = new ConcurrentHashMap<String, Boolean>();
|
||||
private List<String> antibot = new ArrayList<String>();
|
||||
|
||||
public AuthMePlayerListener(AuthMe plugin, DataSource data) {
|
||||
public AuthMePlayerListener(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@ -77,7 +74,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
return;
|
||||
|
||||
if (!data.isAuthAvailable(name))
|
||||
if (!plugin.database.isAuthAvailable(name))
|
||||
if (!Settings.isForcedRegistrationEnabled)
|
||||
return;
|
||||
|
||||
@ -113,7 +110,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
String cmd = event.getMessage().split(" ")[0];
|
||||
|
||||
if (data.isAuthAvailable(name)) {
|
||||
if (plugin.database.isAuthAvailable(name)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
@ -150,7 +147,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
String cmd = event.getMessage().split(" ")[0];
|
||||
|
||||
if (data.isAuthAvailable(name)) {
|
||||
if (plugin.database.isAuthAvailable(name)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
@ -187,7 +184,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
String cmd = event.getMessage().split(" ")[0];
|
||||
|
||||
if (data.isAuthAvailable(name)) {
|
||||
if (plugin.database.isAuthAvailable(name)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
@ -224,7 +221,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
String cmd = event.getMessage().split(" ")[0];
|
||||
|
||||
if (data.isAuthAvailable(name)) {
|
||||
if (plugin.database.isAuthAvailable(name)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
@ -262,7 +259,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
String cmd = event.getMessage().split(" ")[0];
|
||||
|
||||
if (data.isAuthAvailable(name)) {
|
||||
if (plugin.database.isAuthAvailable(name)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
@ -299,7 +296,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
String cmd = event.getMessage().split(" ")[0];
|
||||
|
||||
if (data.isAuthAvailable(name)) {
|
||||
if (plugin.database.isAuthAvailable(name)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
@ -336,7 +333,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
}
|
||||
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
if (!data.isAuthAvailable(name))
|
||||
if (!plugin.database.isAuthAvailable(name))
|
||||
return;
|
||||
}
|
||||
|
||||
@ -404,7 +401,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
if (player == null)
|
||||
return;
|
||||
final String name = player.getName().toLowerCase();
|
||||
boolean isAuthAvailable = data.isAuthAvailable(name);
|
||||
boolean isAuthAvailable = plugin.database.isAuthAvailable(name);
|
||||
|
||||
if (plugin.getCitizensCommunicator().isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
|
||||
return;
|
||||
@ -428,7 +425,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
}
|
||||
|
||||
if (Settings.isKickNonRegisteredEnabled) {
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
event.setKickMessage(m.send("reg_only")[0]);
|
||||
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
|
||||
return;
|
||||
@ -579,7 +576,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
plugin.management.performQuit(player, false);
|
||||
|
||||
if (data.getAuth(name) != null && !PlayerCache.getInstance().isAuthenticated(name) && Settings.enableProtection)
|
||||
if (plugin.database.getAuth(name) != null && !PlayerCache.getInstance().isAuthenticated(name) && Settings.enableProtection)
|
||||
event.setQuitMessage(null);
|
||||
}
|
||||
|
||||
@ -622,7 +619,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -650,7 +647,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -679,7 +676,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -708,7 +705,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -734,7 +731,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -761,7 +758,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -785,7 +782,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -806,7 +803,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
return;
|
||||
}
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -832,15 +829,15 @@ public class AuthMePlayerListener implements Listener {
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
return;
|
||||
|
||||
if (!data.isAuthAvailable(name))
|
||||
if (!plugin.database.isAuthAvailable(name))
|
||||
if (!Settings.isForcedRegistrationEnabled)
|
||||
return;
|
||||
|
||||
Location spawn = plugin.getSpawnLocation(player);
|
||||
if (Settings.isSaveQuitLocationEnabled && data.isAuthAvailable(name)) {
|
||||
if (Settings.isSaveQuitLocationEnabled && plugin.database.isAuthAvailable(name)) {
|
||||
final PlayerAuth auth = new PlayerAuth(name, spawn.getX(), spawn.getY(), spawn.getZ(), spawn.getWorld().getName());
|
||||
try {
|
||||
data.updateQuitLoc(auth);
|
||||
plugin.database.updateQuitLoc(auth);
|
||||
} catch (NullPointerException npe) {
|
||||
}
|
||||
}
|
||||
@ -871,7 +868,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
return;
|
||||
|
||||
if (!data.isAuthAvailable(name))
|
||||
if (!plugin.database.isAuthAvailable(name))
|
||||
if (!Settings.isForcedRegistrationEnabled)
|
||||
return;
|
||||
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.process.join.AsyncronousJoin;
|
||||
import fr.xephi.authme.process.login.AsyncronousLogin;
|
||||
import fr.xephi.authme.process.logout.AsyncronousLogout;
|
||||
@ -22,13 +21,11 @@ import fr.xephi.authme.settings.Settings;
|
||||
*/
|
||||
public class Management {
|
||||
|
||||
public DataSource database;
|
||||
public AuthMe plugin;
|
||||
public static RandomString rdm = new RandomString(Settings.captchaLength);
|
||||
public PluginManager pm;
|
||||
|
||||
public Management(DataSource database, AuthMe plugin) {
|
||||
this.database = database;
|
||||
public Management(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.pm = plugin.getServer().getPluginManager();
|
||||
}
|
||||
@ -39,7 +36,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousLogin(player, password, forceLogin, plugin, database).process();
|
||||
new AsyncronousLogin(player, password, forceLogin, plugin, plugin.database).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -50,7 +47,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousRegister(player, password, email, plugin, database).process();
|
||||
new AsyncronousRegister(player, password, email, plugin, plugin.database).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -60,7 +57,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousLogout(player, plugin, database).process();
|
||||
new AsyncronousLogout(player, plugin, plugin.database).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -70,7 +67,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousQuit(player, plugin, database, isKick).process();
|
||||
new AsyncronousQuit(player, plugin, plugin.database, isKick).process();
|
||||
}
|
||||
|
||||
});
|
||||
@ -81,7 +78,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousJoin(player, plugin, database).process();
|
||||
new AsyncronousJoin(player, plugin, plugin.database).process();
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -17,6 +17,7 @@ import fr.xephi.authme.events.AuthMeTeleportEvent;
|
||||
import fr.xephi.authme.events.LoginEvent;
|
||||
import fr.xephi.authme.events.RegisterTeleportEvent;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.PlayersLogs;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.task.MessageTask;
|
||||
import fr.xephi.authme.task.TimeoutTask;
|
||||
@ -71,7 +72,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||
BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval));
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT);
|
||||
try {
|
||||
plugin.pllog.removePlayer(name);
|
||||
PlayersLogs.getInstance().save();
|
||||
if (player.isInsideVehicle())
|
||||
player.getVehicle().eject();
|
||||
} catch (NullPointerException npe) {
|
||||
|
@ -2,8 +2,14 @@ package fr.xephi.authme.settings;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Xephi59
|
||||
@ -11,19 +17,27 @@ import java.util.List;
|
||||
public class PlayersLogs extends CustomConfiguration {
|
||||
|
||||
private static PlayersLogs pllog = null;
|
||||
public List<String> players;
|
||||
|
||||
public PlayersLogs() {
|
||||
super(new File("." + File.separator + "plugins" + File.separator + "AuthMe" + File.separator + "players.yml"));
|
||||
pllog = this;
|
||||
load();
|
||||
save();
|
||||
players = this.getStringList("players");
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
set("players", new ArrayList<String>());
|
||||
save();
|
||||
public void loadPlayers() {
|
||||
DataSource database = AuthMe.getInstance().database;
|
||||
List<String> list = this.getStringList("players");
|
||||
if (list == null || list.isEmpty())
|
||||
return;
|
||||
for (String s : list) {
|
||||
PlayerAuth auth = database.getAuth(s);
|
||||
if (auth == null)
|
||||
continue;
|
||||
auth.setLastLogin(new Date().getTime());
|
||||
database.updateSession(auth);
|
||||
PlayerCache.getInstance().addPlayer(auth);
|
||||
}
|
||||
}
|
||||
|
||||
public static PlayersLogs getInstance() {
|
||||
@ -33,21 +47,18 @@ public class PlayersLogs extends CustomConfiguration {
|
||||
return pllog;
|
||||
}
|
||||
|
||||
public void addPlayer(String user) {
|
||||
players = this.getStringList("players");
|
||||
if (!players.contains(user.toLowerCase())) {
|
||||
players.add(user.toLowerCase());
|
||||
set("players", players);
|
||||
save();
|
||||
public void savePlayerLogs() {
|
||||
List<String> players = new ArrayList<String>();
|
||||
for (String s : PlayerCache.getInstance().getCache().keySet()) {
|
||||
players.add(s);
|
||||
}
|
||||
this.set("players", players);
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void removePlayer(String user) {
|
||||
players = this.getStringList("players");
|
||||
if (players.contains(user.toLowerCase())) {
|
||||
players.remove(user.toLowerCase());
|
||||
set("players", players);
|
||||
save();
|
||||
}
|
||||
public void clear() {
|
||||
this.set("players", new ArrayList<String>());
|
||||
this.save();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user