mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-01-26 01:21:27 +01:00
commit
383bd0f704
4
pom.xml
4
pom.xml
@ -216,7 +216,7 @@
|
|||||||
<groupId>javax.mail</groupId>
|
<groupId>javax.mail</groupId>
|
||||||
<artifactId>javax.mail-api</artifactId>
|
<artifactId>javax.mail-api</artifactId>
|
||||||
<version>1.5.4</version>
|
<version>1.5.4</version>
|
||||||
<scope>compile</scope>
|
<scope>provided</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -508,6 +508,8 @@
|
|||||||
<groupId>net.ricecode</groupId>
|
<groupId>net.ricecode</groupId>
|
||||||
<artifactId>string-similarity</artifactId>
|
<artifactId>string-similarity</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -45,7 +45,6 @@ import fr.xephi.authme.datasource.DatabaseCalls;
|
|||||||
import fr.xephi.authme.datasource.FlatFile;
|
import fr.xephi.authme.datasource.FlatFile;
|
||||||
import fr.xephi.authme.datasource.MySQL;
|
import fr.xephi.authme.datasource.MySQL;
|
||||||
import fr.xephi.authme.datasource.SQLite;
|
import fr.xephi.authme.datasource.SQLite;
|
||||||
import fr.xephi.authme.datasource.SQLite_HIKARI;
|
|
||||||
import fr.xephi.authme.listener.AuthMeBlockListener;
|
import fr.xephi.authme.listener.AuthMeBlockListener;
|
||||||
import fr.xephi.authme.listener.AuthMeEntityListener;
|
import fr.xephi.authme.listener.AuthMeEntityListener;
|
||||||
import fr.xephi.authme.listener.AuthMeInventoryPacketAdapter;
|
import fr.xephi.authme.listener.AuthMeInventoryPacketAdapter;
|
||||||
@ -434,10 +433,6 @@ public class AuthMe extends JavaPlugin {
|
|||||||
database = new SQLite();
|
database = new SQLite();
|
||||||
isSQLite = true;
|
isSQLite = true;
|
||||||
break;
|
break;
|
||||||
case SQLITEHIKARI:
|
|
||||||
database = new SQLite_HIKARI();
|
|
||||||
isSQLite = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSQLite) {
|
if (isSQLite) {
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package fr.xephi.authme;
|
package fr.xephi.authme;
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
|
||||||
import fr.xephi.authme.api.NewAPI;
|
|
||||||
import fr.xephi.authme.settings.Settings;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.StandardOpenOption;
|
import java.nio.file.StandardOpenOption;
|
||||||
@ -12,6 +8,11 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import com.google.common.base.Throwables;
|
||||||
|
|
||||||
|
import fr.xephi.authme.api.NewAPI;
|
||||||
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
|
||||||
public class ConsoleLogger {
|
public class ConsoleLogger {
|
||||||
|
|
||||||
private static final Logger log = AuthMe.getInstance().getLogger();
|
private static final Logger log = AuthMe.getInstance().getLogger();
|
||||||
|
@ -37,7 +37,6 @@ public class PerformBackup {
|
|||||||
return FileBackup("auths.db");
|
return FileBackup("auths.db");
|
||||||
case MYSQL:
|
case MYSQL:
|
||||||
return MySqlBackup();
|
return MySqlBackup();
|
||||||
case SQLITEHIKARI:
|
|
||||||
case SQLITE:
|
case SQLITE:
|
||||||
return FileBackup(Settings.getMySQLDatabase + ".db");
|
return FileBackup(Settings.getMySQLDatabase + ".db");
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,11 @@ package fr.xephi.authme.command.executable.authme;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.command.CommandParts;
|
import fr.xephi.authme.command.CommandParts;
|
||||||
import fr.xephi.authme.command.ExecutableCommand;
|
import fr.xephi.authme.command.ExecutableCommand;
|
||||||
|
@ -1,25 +1,24 @@
|
|||||||
package fr.xephi.authme.command.executable.authme;
|
package fr.xephi.authme.command.executable.authme;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
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.command.CommandParts;
|
import fr.xephi.authme.command.CommandParts;
|
||||||
import fr.xephi.authme.command.ExecutableCommand;
|
import fr.xephi.authme.command.ExecutableCommand;
|
||||||
import fr.xephi.authme.events.SpawnTeleportEvent;
|
|
||||||
import fr.xephi.authme.settings.Messages;
|
import fr.xephi.authme.settings.Messages;
|
||||||
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;
|
||||||
import fr.xephi.authme.util.Utils;
|
import fr.xephi.authme.util.Utils;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
|
||||||
|
|
||||||
public class UnregisterCommand extends ExecutableCommand {
|
public class UnregisterCommand extends ExecutableCommand {
|
||||||
|
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package fr.xephi.authme.command.executable.email;
|
package fr.xephi.authme.command.executable.email;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.command.CommandParts;
|
import fr.xephi.authme.command.CommandParts;
|
||||||
import fr.xephi.authme.command.ExecutableCommand;
|
import fr.xephi.authme.command.ExecutableCommand;
|
||||||
import fr.xephi.authme.settings.Messages;
|
import fr.xephi.authme.settings.Messages;
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class AddEmailCommand extends ExecutableCommand {
|
public class AddEmailCommand extends ExecutableCommand {
|
||||||
|
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package fr.xephi.authme.command.executable.email;
|
package fr.xephi.authme.command.executable.email;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.command.CommandParts;
|
import fr.xephi.authme.command.CommandParts;
|
||||||
import fr.xephi.authme.command.ExecutableCommand;
|
import fr.xephi.authme.command.ExecutableCommand;
|
||||||
import fr.xephi.authme.settings.Messages;
|
import fr.xephi.authme.settings.Messages;
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class ChangeEmailCommand extends ExecutableCommand {
|
public class ChangeEmailCommand extends ExecutableCommand {
|
||||||
|
|
||||||
|
@ -1,5 +1,23 @@
|
|||||||
package fr.xephi.authme.commands;
|
package fr.xephi.authme.commands;
|
||||||
|
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
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;
|
||||||
@ -14,23 +32,6 @@ import fr.xephi.authme.task.MessageTask;
|
|||||||
import fr.xephi.authme.task.TimeoutTask;
|
import fr.xephi.authme.task.TimeoutTask;
|
||||||
import fr.xephi.authme.util.Utils;
|
import fr.xephi.authme.util.Utils;
|
||||||
import fr.xephi.authme.util.Utils.GroupType;
|
import fr.xephi.authme.util.Utils.GroupType;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
|
||||||
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AdminCommand implements CommandExecutor {
|
public class AdminCommand implements CommandExecutor {
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ public class AdminCommand implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandSender sender, Command cmnd,
|
public boolean onCommand(final CommandSender sender, Command cmnd,
|
||||||
String label, String[] args) {
|
String label, String[] args) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
sender.sendMessage("Usage:");
|
sender.sendMessage("Usage:");
|
||||||
sender.sendMessage("/authme reload - Reload the config");
|
sender.sendMessage("/authme reload - Reload the config");
|
||||||
@ -195,6 +196,7 @@ public class AdminCommand implements CommandExecutor {
|
|||||||
} else {
|
} else {
|
||||||
final String[] arguments = args;
|
final String[] arguments = args;
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
StringBuilder message = new StringBuilder("[AuthMe] ");
|
StringBuilder message = new StringBuilder("[AuthMe] ");
|
||||||
@ -262,6 +264,7 @@ public class AdminCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -484,7 +487,7 @@ public class AdminCommand implements CommandExecutor {
|
|||||||
Location spawn = plugin.getSpawnLocation(target);
|
Location spawn = plugin.getSpawnLocation(target);
|
||||||
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(target, target.getLocation(), spawn, false);
|
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(target, target.getLocation(), spawn, false);
|
||||||
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
||||||
if (!tpEvent.isCancelled()) {
|
if (!tpEvent.isCancelled() && tpEvent.getTo() != null) {
|
||||||
target.teleport(tpEvent.getTo());
|
target.teleport(tpEvent.getTo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
package fr.xephi.authme.commands;
|
package fr.xephi.authme.commands;
|
||||||
|
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
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;
|
||||||
@ -8,12 +15,6 @@ 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;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Xephi59
|
* @author Xephi59
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
package fr.xephi.authme.datasource;
|
package fr.xephi.authme.datasource;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
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.util.Utils;
|
import fr.xephi.authme.util.Utils;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.*;
|
|
||||||
|
|
||||||
public class CacheDataSource implements DataSource {
|
public class CacheDataSource implements DataSource {
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package fr.xephi.authme.datasource;
|
package fr.xephi.authme.datasource;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
@ -10,8 +9,7 @@ public interface DataSource {
|
|||||||
enum DataSourceType {
|
enum DataSourceType {
|
||||||
MYSQL,
|
MYSQL,
|
||||||
FILE,
|
FILE,
|
||||||
SQLITE,
|
SQLITE
|
||||||
SQLITEHIKARI
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isAuthAvailable(String user);
|
boolean isAuthAvailable(String user);
|
||||||
|
@ -1,18 +1,24 @@
|
|||||||
package fr.xephi.authme.datasource;
|
package fr.xephi.authme.datasource;
|
||||||
|
|
||||||
|
import java.sql.Blob;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.zaxxer.hikari.HikariConfig;
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import com.zaxxer.hikari.pool.PoolInitializationException;
|
import com.zaxxer.hikari.pool.PoolInitializationException;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
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.security.HashAlgorithm;
|
import fr.xephi.authme.security.HashAlgorithm;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
|
||||||
import java.sql.*;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MySQL implements DataSource {
|
public class MySQL implements DataSource {
|
||||||
|
|
||||||
private String host;
|
private String host;
|
||||||
|
@ -1,749 +0,0 @@
|
|||||||
package fr.xephi.authme.datasource;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Statement;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.zaxxer.hikari.HikariConfig;
|
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
|
||||||
import fr.xephi.authme.settings.Settings;
|
|
||||||
|
|
||||||
public class SQLite_HIKARI implements DataSource {
|
|
||||||
|
|
||||||
private String database;
|
|
||||||
private String tableName;
|
|
||||||
private String columnName;
|
|
||||||
private String columnPassword;
|
|
||||||
private String columnIp;
|
|
||||||
private String columnLastLogin;
|
|
||||||
private String columnSalt;
|
|
||||||
private String columnGroup;
|
|
||||||
private String lastlocX;
|
|
||||||
private String lastlocY;
|
|
||||||
private String lastlocZ;
|
|
||||||
private String lastlocWorld;
|
|
||||||
private String columnEmail;
|
|
||||||
private String columnID;
|
|
||||||
private HikariDataSource ds;
|
|
||||||
private String columnLogged;
|
|
||||||
private String columnRealName;
|
|
||||||
|
|
||||||
public SQLite_HIKARI() throws ClassNotFoundException, SQLException {
|
|
||||||
this.database = Settings.getMySQLDatabase;
|
|
||||||
this.tableName = Settings.getMySQLTablename;
|
|
||||||
this.columnName = Settings.getMySQLColumnName;
|
|
||||||
this.columnPassword = Settings.getMySQLColumnPassword;
|
|
||||||
this.columnIp = Settings.getMySQLColumnIp;
|
|
||||||
this.columnLastLogin = Settings.getMySQLColumnLastLogin;
|
|
||||||
this.columnSalt = Settings.getMySQLColumnSalt;
|
|
||||||
this.columnGroup = Settings.getMySQLColumnGroup;
|
|
||||||
this.lastlocX = Settings.getMySQLlastlocX;
|
|
||||||
this.lastlocY = Settings.getMySQLlastlocY;
|
|
||||||
this.lastlocZ = Settings.getMySQLlastlocZ;
|
|
||||||
this.lastlocWorld = Settings.getMySQLlastlocWorld;
|
|
||||||
this.columnEmail = Settings.getMySQLColumnEmail;
|
|
||||||
this.columnID = Settings.getMySQLColumnId;
|
|
||||||
this.columnLogged = Settings.getMySQLColumnLogged;
|
|
||||||
this.columnRealName = Settings.getMySQLColumnRealName;
|
|
||||||
|
|
||||||
// Set the connection arguments
|
|
||||||
try {
|
|
||||||
this.setConnectionArguments();
|
|
||||||
} catch (RuntimeException rt) {
|
|
||||||
ConsoleLogger.showError("Can't use the Hikari Connection Pool! Please, report this error to the developer!");
|
|
||||||
throw rt;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize the database
|
|
||||||
try {
|
|
||||||
this.setupConnection();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
this.close();
|
|
||||||
ConsoleLogger.showError("Can't initialize the SQLite database... Please check your database settings in the config.yml file! SHUTDOWN...");
|
|
||||||
ConsoleLogger.showError("If this error persists, please report it to the developer! SHUTDOWN...");
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DataSourceType getType() {
|
|
||||||
return DataSourceType.SQLITEHIKARI;
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void setConnectionArguments() throws RuntimeException {
|
|
||||||
HikariConfig config = new HikariConfig();
|
|
||||||
config.setPoolName("AuthMeSQLitePool");
|
|
||||||
config.setDriverClassName("org.sqlite.JDBC"); // RuntimeException
|
|
||||||
config.setJdbcUrl("jdbc:sqlite:plugins/AuthMe/" + database + ".db");
|
|
||||||
config.setMaxLifetime(180000); // 3 Min
|
|
||||||
config.setIdleTimeout(60000); // 1 Min
|
|
||||||
config.setMinimumIdle(2);
|
|
||||||
config.setMaximumPoolSize(8); // don't set too much
|
|
||||||
ds = new HikariDataSource(config);
|
|
||||||
ConsoleLogger.info("Connection arguments loaded, Hikari ConnectionPool ready!");
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void reloadArguments()
|
|
||||||
throws ClassNotFoundException, IllegalArgumentException {
|
|
||||||
if (ds != null) {
|
|
||||||
ds.close();
|
|
||||||
}
|
|
||||||
setConnectionArguments();
|
|
||||||
ConsoleLogger.info("Hikari ConnectionPool arguments reloaded!");
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized Connection getConnection() throws SQLException {
|
|
||||||
return ds.getConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void setupConnection() throws SQLException {
|
|
||||||
Connection con = null;
|
|
||||||
Statement st = null;
|
|
||||||
ResultSet rs = null;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
st = con.createStatement();
|
|
||||||
st.executeUpdate("CREATE TABLE IF NOT EXISTS " + tableName + " (" + columnID + " INTEGER AUTO_INCREMENT," + columnName + " VARCHAR(255) NOT NULL UNIQUE," + columnPassword + " VARCHAR(255) NOT NULL," + columnIp + " VARCHAR(40) NOT NULL," + columnLastLogin + " BIGINT," + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0'," + lastlocWorld + " VARCHAR(255) NOT NULL DEFAULT '" + Settings.defaultWorld + "'," + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com'," + "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));");
|
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, columnPassword);
|
|
||||||
if (!rs.next()) {
|
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnPassword + " VARCHAR(255) NOT NULL;");
|
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, columnIp);
|
|
||||||
if (!rs.next()) {
|
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnIp + " VARCHAR(40) NOT NULL;");
|
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, columnLastLogin);
|
|
||||||
if (!rs.next()) {
|
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnLastLogin + " BIGINT DEFAULT '0';");
|
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
|
||||||
if (!rs.next()) {
|
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocX + " DOUBLE NOT NULL DEFAULT '0.0';");
|
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocY + " DOUBLE NOT NULL DEFAULT '0.0';");
|
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0';");
|
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, lastlocWorld);
|
|
||||||
if (!rs.next()) {
|
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + lastlocWorld + " VARCHAR(255) NOT NULL DEFAULT 'world';");
|
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, columnEmail);
|
|
||||||
if (!rs.next()) {
|
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com';");
|
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, columnLogged);
|
|
||||||
if (!rs.next()) {
|
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnLogged + " BIGINT DEFAULT '0';");
|
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, columnRealName);
|
|
||||||
if (!rs.next()) {
|
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnRealName + " VARCHAR(255) NOT NULL DEFAULT 'Player';");
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
close(rs);
|
|
||||||
close(st);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
ConsoleLogger.info("SQLite Setup finished");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized boolean isAuthAvailable(String user) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
ResultSet rs = null;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=LOWER(?);");
|
|
||||||
pst.setString(1, user);
|
|
||||||
rs = pst.executeQuery();
|
|
||||||
return rs.next();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
close(rs);
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized PlayerAuth getAuth(String user) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
ResultSet rs = null;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=LOWER(?);");
|
|
||||||
pst.setString(1, user);
|
|
||||||
rs = pst.executeQuery();
|
|
||||||
if (rs.next()) {
|
|
||||||
if (rs.getString(columnIp).isEmpty()) {
|
|
||||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "192.168.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
|
||||||
} else {
|
|
||||||
if (!columnSalt.isEmpty()) {
|
|
||||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
|
||||||
} else {
|
|
||||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
return null;
|
|
||||||
} finally {
|
|
||||||
close(rs);
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized boolean saveAuth(PlayerAuth auth) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
if (columnSalt.isEmpty() && auth.getSalt().isEmpty()) {
|
|
||||||
pst = con.prepareStatement("INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + "," + columnRealName + ") VALUES (?,?,?,?,?);");
|
|
||||||
pst.setString(1, auth.getNickname());
|
|
||||||
pst.setString(2, auth.getHash());
|
|
||||||
pst.setString(3, auth.getIp());
|
|
||||||
pst.setLong(4, auth.getLastLogin());
|
|
||||||
pst.setString(5, auth.getRealName());
|
|
||||||
pst.executeUpdate();
|
|
||||||
} else {
|
|
||||||
pst = con.prepareStatement("INSERT INTO " + tableName + "(" + columnName + "," + columnPassword + "," + columnIp + "," + columnLastLogin + "," + columnSalt + "," + columnRealName + ") VALUES (?,?,?,?,?,?);");
|
|
||||||
pst.setString(1, auth.getNickname());
|
|
||||||
pst.setString(2, auth.getHash());
|
|
||||||
pst.setString(3, auth.getIp());
|
|
||||||
pst.setLong(4, auth.getLastLogin());
|
|
||||||
pst.setString(5, auth.getSalt());
|
|
||||||
pst.setString(6, auth.getRealName());
|
|
||||||
pst.executeUpdate();
|
|
||||||
}
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized boolean updatePassword(PlayerAuth auth) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnPassword + "=? WHERE " + columnName + "=?;");
|
|
||||||
pst.setString(1, auth.getHash());
|
|
||||||
pst.setString(2, auth.getNickname());
|
|
||||||
pst.executeUpdate();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateSession(PlayerAuth auth) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnIp + "=?, " + columnLastLogin + "=?, " + columnRealName + "=? WHERE " + columnName + "=?;");
|
|
||||||
pst.setString(1, auth.getIp());
|
|
||||||
pst.setLong(2, auth.getLastLogin());
|
|
||||||
pst.setString(3, auth.getRealName());
|
|
||||||
pst.setString(4, auth.getNickname());
|
|
||||||
pst.executeUpdate();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int purgeDatabase(long until) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnLastLogin + "<?;");
|
|
||||||
pst.setLong(1, until);
|
|
||||||
return pst.executeUpdate();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
return 0;
|
|
||||||
} finally {
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> autoPurgeDatabase(long until) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
ResultSet rs = null;
|
|
||||||
List<String> list = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLastLogin + "<?;");
|
|
||||||
pst.setLong(1, until);
|
|
||||||
rs = pst.executeQuery();
|
|
||||||
while (rs.next()) {
|
|
||||||
list.add(rs.getString(columnName));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
return new ArrayList<>();
|
|
||||||
} finally {
|
|
||||||
close(rs);
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized boolean removeAuth(String user) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnName + "=?;");
|
|
||||||
pst.setString(1, user);
|
|
||||||
pst.executeUpdate();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateQuitLoc(PlayerAuth auth) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("UPDATE " + tableName + " SET " + lastlocX + "=?, " + lastlocY + "=?, " + lastlocZ + "=?, " + lastlocWorld + "=? WHERE " + columnName + "=?;");
|
|
||||||
pst.setDouble(1, auth.getQuitLocX());
|
|
||||||
pst.setDouble(2, auth.getQuitLocY());
|
|
||||||
pst.setDouble(3, auth.getQuitLocZ());
|
|
||||||
pst.setString(4, auth.getWorld());
|
|
||||||
pst.setString(5, auth.getNickname());
|
|
||||||
pst.executeUpdate();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getIps(String ip) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
ResultSet rs = null;
|
|
||||||
int countIp = 0;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;");
|
|
||||||
pst.setString(1, ip);
|
|
||||||
rs = pst.executeQuery();
|
|
||||||
while (rs.next()) {
|
|
||||||
countIp++;
|
|
||||||
}
|
|
||||||
return countIp;
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
return 0;
|
|
||||||
} finally {
|
|
||||||
close(rs);
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateEmail(PlayerAuth auth) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnEmail + "=? WHERE " + columnName + "=?;");
|
|
||||||
pst.setString(1, auth.getEmail());
|
|
||||||
pst.setString(2, auth.getNickname());
|
|
||||||
pst.executeUpdate();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateSalt(PlayerAuth auth) {
|
|
||||||
if (columnSalt.isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnSalt + "=? WHERE " + columnName + "=?;");
|
|
||||||
pst.setString(1, auth.getSalt());
|
|
||||||
pst.setString(2, auth.getNickname());
|
|
||||||
pst.executeUpdate();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getAllAuthsByName(PlayerAuth auth) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
ResultSet rs = null;
|
|
||||||
List<String> countIp = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;");
|
|
||||||
pst.setString(1, auth.getIp());
|
|
||||||
rs = pst.executeQuery();
|
|
||||||
while (rs.next()) {
|
|
||||||
countIp.add(rs.getString(columnName));
|
|
||||||
}
|
|
||||||
return countIp;
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
return new ArrayList<>();
|
|
||||||
} catch (NullPointerException npe) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
} finally {
|
|
||||||
close(rs);
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getAllAuthsByIp(String ip) throws SQLException {
|
|
||||||
final Connection con = getConnection();
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
ResultSet rs = null;
|
|
||||||
List<String> countIp = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnIp + "=?;");
|
|
||||||
pst.setString(1, ip);
|
|
||||||
rs = pst.executeQuery();
|
|
||||||
while (rs.next()) {
|
|
||||||
countIp.add(rs.getString(columnName));
|
|
||||||
}
|
|
||||||
return countIp;
|
|
||||||
} finally {
|
|
||||||
close(rs);
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getAllAuthsByEmail(String email) throws SQLException {
|
|
||||||
final Connection con = getConnection();
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
ResultSet rs = null;
|
|
||||||
List<String> countEmail = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnEmail + "=?;");
|
|
||||||
pst.setString(1, email);
|
|
||||||
rs = pst.executeQuery();
|
|
||||||
while (rs.next()) {
|
|
||||||
countEmail.add(rs.getString(columnName));
|
|
||||||
}
|
|
||||||
return countEmail;
|
|
||||||
} finally {
|
|
||||||
close(rs);
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void purgeBanned(List<String> banned) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
for (String name : banned) {
|
|
||||||
pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + columnName + "=?;");
|
|
||||||
pst.setString(1, name);
|
|
||||||
pst.executeUpdate();
|
|
||||||
}
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
} finally {
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isLogged(String user) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
ResultSet rs = null;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWER(" + columnName + ")=?;");
|
|
||||||
pst.setString(1, user);
|
|
||||||
rs = pst.executeQuery();
|
|
||||||
if (rs.next())
|
|
||||||
return (rs.getInt(columnLogged) == 1);
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
close(rs);
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setLogged(String user) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE LOWER(" + columnName + ")=?;");
|
|
||||||
pst.setInt(1, 1);
|
|
||||||
pst.setString(2, user);
|
|
||||||
pst.executeUpdate();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
} finally {
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setUnlogged(String user) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
if (user != null)
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE LOWER(" + columnName + ")=?;");
|
|
||||||
pst.setInt(1, 0);
|
|
||||||
pst.setString(2, user);
|
|
||||||
pst.executeUpdate();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
} finally {
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void purgeLogged() {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE " + columnLogged + "=?;");
|
|
||||||
pst.setInt(1, 0);
|
|
||||||
pst.setInt(2, 1);
|
|
||||||
pst.executeUpdate();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
} finally {
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getAccountsRegistered() {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
ResultSet rs;
|
|
||||||
int result = 0;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("SELECT COUNT(*) FROM " + tableName + ";");
|
|
||||||
rs = pst.executeQuery();
|
|
||||||
if (rs != null && rs.next()) {
|
|
||||||
result = rs.getInt(1);
|
|
||||||
}
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
return result;
|
|
||||||
} finally {
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateName(String oldone, String newone) {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnName + "=? WHERE " + columnName + "=?;");
|
|
||||||
pst.setString(1, newone);
|
|
||||||
pst.setString(2, oldone);
|
|
||||||
pst.executeUpdate();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
} finally {
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<PlayerAuth> getAllAuths() {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
ResultSet rs;
|
|
||||||
List<PlayerAuth> auths = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("SELECT * FROM " + tableName + ";");
|
|
||||||
rs = pst.executeQuery();
|
|
||||||
while (rs.next()) {
|
|
||||||
PlayerAuth pAuth;
|
|
||||||
if (rs.getString(columnIp).isEmpty()) {
|
|
||||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "127.0.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
|
||||||
} else {
|
|
||||||
if (!columnSalt.isEmpty()) {
|
|
||||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
|
||||||
} else {
|
|
||||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
auths.add(pAuth);
|
|
||||||
}
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
return auths;
|
|
||||||
} finally {
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
return auths;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<PlayerAuth> getLoggedPlayers() {
|
|
||||||
Connection con = null;
|
|
||||||
PreparedStatement pst = null;
|
|
||||||
ResultSet rs;
|
|
||||||
List<PlayerAuth> auths = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
con = getConnection();
|
|
||||||
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnLogged + "=1;");
|
|
||||||
rs = pst.executeQuery();
|
|
||||||
while (rs.next()) {
|
|
||||||
PlayerAuth pAuth;
|
|
||||||
if (rs.getString(columnIp).isEmpty()) {
|
|
||||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "127.0.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
|
||||||
} else {
|
|
||||||
if (!columnSalt.isEmpty()) {
|
|
||||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
|
||||||
} else {
|
|
||||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
auths.add(pAuth);
|
|
||||||
}
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
} finally {
|
|
||||||
close(pst);
|
|
||||||
close(con);
|
|
||||||
}
|
|
||||||
return auths;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void reload() {
|
|
||||||
try {
|
|
||||||
reloadArguments();
|
|
||||||
} catch (Exception e) {
|
|
||||||
ConsoleLogger.showError(e.getMessage());
|
|
||||||
ConsoleLogger.showError("Can't reconnect to SQLite database... Please check your SQLite informations ! SHUTDOWN...");
|
|
||||||
if (Settings.isStopEnabled) {
|
|
||||||
AuthMe.getInstance().getServer().shutdown();
|
|
||||||
}
|
|
||||||
if (!Settings.isStopEnabled)
|
|
||||||
AuthMe.getInstance().getServer().getPluginManager().disablePlugin(AuthMe.getInstance());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void close() {
|
|
||||||
if (ds != null)
|
|
||||||
ds.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void close(AutoCloseable o) {
|
|
||||||
if (o != null) {
|
|
||||||
try {
|
|
||||||
o.close();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -200,7 +200,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerJoin(final PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
if (event.getPlayer() == null)
|
if (event.getPlayer() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -227,15 +227,14 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPreLogin(AsyncPlayerPreLoginEvent event) {
|
public void onPreLogin(AsyncPlayerPreLoginEvent event) {
|
||||||
final String name = event.getName().toLowerCase();
|
final String name = event.getName().toLowerCase();
|
||||||
final Player player = plugin.dataManager.getOnlinePlayerLower(name);
|
final Player player = plugin.getServer().getPlayer(name);
|
||||||
if (player == null)
|
if (player == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Check if forceSingleSession is set to true, so kick player that has
|
// Check if forceSingleSession is set to true, so kick player that has
|
||||||
// joined with same nick of online player
|
// joined with same nick of online player
|
||||||
if (Settings.isForceSingleSessionEnabled) {
|
if (Settings.isForceSingleSessionEnabled && player.isOnline()) {
|
||||||
event.setKickMessage(m.getString("same_nick"));
|
event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, m.getString("same_nick"));
|
||||||
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
|
|
||||||
if (LimboCache.getInstance().hasLimboPlayer(name))
|
if (LimboCache.getInstance().hasLimboPlayer(name))
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package fr.xephi.authme.process;
|
package fr.xephi.authme.process;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.process.email.AsyncChangeEmail;
|
import fr.xephi.authme.process.email.AsyncChangeEmail;
|
||||||
import fr.xephi.authme.process.join.AsyncronousJoin;
|
import fr.xephi.authme.process.join.AsyncronousJoin;
|
||||||
@ -10,8 +13,6 @@ import fr.xephi.authme.process.register.AsyncRegister;
|
|||||||
import fr.xephi.authme.process.unregister.AsyncronousUnregister;
|
import fr.xephi.authme.process.unregister.AsyncronousUnregister;
|
||||||
import fr.xephi.authme.security.RandomString;
|
import fr.xephi.authme.security.RandomString;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @authors Xephi59,
|
* @authors Xephi59,
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
package fr.xephi.authme.process.email;
|
package fr.xephi.authme.process.email;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
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.settings.Messages;
|
import fr.xephi.authme.settings.Messages;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class AsyncChangeEmail {
|
public class AsyncChangeEmail {
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package fr.xephi.authme.process.logout;
|
package fr.xephi.authme.process.logout;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
|
|
||||||
@ -9,9 +8,7 @@ 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.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.events.AuthMeTeleportEvent;
|
|
||||||
import fr.xephi.authme.settings.Messages;
|
import fr.xephi.authme.settings.Messages;
|
||||||
import fr.xephi.authme.settings.Settings;
|
|
||||||
import fr.xephi.authme.util.Utils;
|
import fr.xephi.authme.util.Utils;
|
||||||
import fr.xephi.authme.util.Utils.GroupType;
|
import fr.xephi.authme.util.Utils.GroupType;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class AsyncronousQuit {
|
|||||||
String ip = plugin.getIP(player);
|
String ip = plugin.getIP(player);
|
||||||
|
|
||||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||||
if (Settings.isSaveQuitLocationEnabled && database.isAuthAvailable(name)) {
|
if (Settings.isSaveQuitLocationEnabled) {
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
PlayerAuth auth = new PlayerAuth(name, loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName(), player.getName());
|
PlayerAuth auth = new PlayerAuth(name, loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName(), player.getName());
|
||||||
database.updateQuitLoc(auth);
|
database.updateQuitLoc(auth);
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package fr.xephi.authme.process.register;
|
package fr.xephi.authme.process.register;
|
||||||
|
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
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;
|
||||||
@ -8,10 +13,6 @@ import fr.xephi.authme.datasource.DataSource;
|
|||||||
import fr.xephi.authme.security.PasswordSecurity;
|
import fr.xephi.authme.security.PasswordSecurity;
|
||||||
import fr.xephi.authme.settings.Messages;
|
import fr.xephi.authme.settings.Messages;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class AsyncRegister {
|
public class AsyncRegister {
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package fr.xephi.authme.process.register;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
@ -12,9 +11,7 @@ import fr.xephi.authme.AuthMe;
|
|||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
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.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.RestoreInventoryEvent;
|
import fr.xephi.authme.events.RestoreInventoryEvent;
|
||||||
import fr.xephi.authme.settings.Messages;
|
import fr.xephi.authme.settings.Messages;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
@ -2,7 +2,6 @@ package fr.xephi.authme.process.unregister;
|
|||||||
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
@ -14,7 +13,6 @@ import fr.xephi.authme.ConsoleLogger;
|
|||||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||||
import fr.xephi.authme.cache.backup.JsonCache;
|
import fr.xephi.authme.cache.backup.JsonCache;
|
||||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||||
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;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
@ -1,16 +1,22 @@
|
|||||||
package fr.xephi.authme.settings;
|
package fr.xephi.authme.settings;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.datasource.DataSource.DataSourceType;
|
import fr.xephi.authme.datasource.DataSource.DataSourceType;
|
||||||
import fr.xephi.authme.security.HashAlgorithm;
|
import fr.xephi.authme.security.HashAlgorithm;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public final class Settings extends YamlConfiguration {
|
public final class Settings extends YamlConfiguration {
|
||||||
|
|
||||||
|
@ -12,8 +12,6 @@ import java.util.Collection;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import fr.xephi.authme.events.SpawnTeleportEvent;
|
|
||||||
import fr.xephi.authme.settings.Spawn;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
DataSource:
|
DataSource:
|
||||||
# What type of database do you want to use?
|
# What type of database do you want to use?
|
||||||
# Can be set to: sqlite, sqlitehikari, mysql
|
# Valid values: sqlite, mysql
|
||||||
# (sqlitehikari should be more fast than normal sqlite but it's an experimental feature!)
|
|
||||||
backend: sqlite
|
backend: sqlite
|
||||||
# Enable database caching
|
# Enable database caching, should improve database performance
|
||||||
caching: true
|
caching: true
|
||||||
# Database location
|
# Database location
|
||||||
mySQLHost: 127.0.0.1
|
mySQLHost: 127.0.0.1
|
||||||
@ -136,6 +135,7 @@ settings:
|
|||||||
# permission: /authme.admin.accounts
|
# permission: /authme.admin.accounts
|
||||||
displayOtherAccounts: true
|
displayOtherAccounts: true
|
||||||
# WorldNames where we need to force the spawn location for ForceSpawnLocOnJoinEnabled
|
# WorldNames where we need to force the spawn location for ForceSpawnLocOnJoinEnabled
|
||||||
|
# CASE SENSITIVE
|
||||||
ForceSpawnOnTheseWorlds:
|
ForceSpawnOnTheseWorlds:
|
||||||
- world
|
- world
|
||||||
- world_nether
|
- world_nether
|
||||||
|
Loading…
Reference in New Issue
Block a user