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