Update 3.3.4
//Changes 3.3.4:// * Add an isLogged column in mySQL * Add a maxLoginPerIp * Add a maxJoinPerIp * Add a way to force kick after register * Add a way to force login after register * Update session correctly * Fix Change Email command * Fix some perm problems * Fix some problems with email sending * Remove some dead code * Add a way to control spawn priority, by default , in order, it is : authme,essentials,multiverse,default
This commit is contained in:
parent
4e7e9e6cb4
commit
b659d8968e
2
pom.xml
2
pom.xml
@ -24,7 +24,7 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<version>3.3.3</version>
|
<version>3.3.4</version>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
|
|||||||
@ -55,7 +55,6 @@ import fr.xephi.authme.datasource.FileDataSource;
|
|||||||
import fr.xephi.authme.datasource.MySQLDataSource;
|
import fr.xephi.authme.datasource.MySQLDataSource;
|
||||||
import fr.xephi.authme.datasource.SqliteDataSource;
|
import fr.xephi.authme.datasource.SqliteDataSource;
|
||||||
import fr.xephi.authme.listener.AuthMeBlockListener;
|
import fr.xephi.authme.listener.AuthMeBlockListener;
|
||||||
import fr.xephi.authme.listener.AuthMeBungeeCordListener;
|
|
||||||
import fr.xephi.authme.listener.AuthMeChestShopListener;
|
import fr.xephi.authme.listener.AuthMeChestShopListener;
|
||||||
import fr.xephi.authme.listener.AuthMeEntityListener;
|
import fr.xephi.authme.listener.AuthMeEntityListener;
|
||||||
import fr.xephi.authme.listener.AuthMePlayerListener;
|
import fr.xephi.authme.listener.AuthMePlayerListener;
|
||||||
@ -74,7 +73,6 @@ import fr.xephi.authme.threads.FlatFileThread;
|
|||||||
import fr.xephi.authme.threads.MySQLThread;
|
import fr.xephi.authme.threads.MySQLThread;
|
||||||
import fr.xephi.authme.threads.SQLiteThread;
|
import fr.xephi.authme.threads.SQLiteThread;
|
||||||
|
|
||||||
|
|
||||||
public class AuthMe extends JavaPlugin {
|
public class AuthMe extends JavaPlugin {
|
||||||
|
|
||||||
public DataSource database = null;
|
public DataSource database = null;
|
||||||
@ -85,7 +83,6 @@ public class AuthMe extends JavaPlugin {
|
|||||||
public static Logger authmeLogger = Logger.getLogger("AuthMe");
|
public static Logger authmeLogger = Logger.getLogger("AuthMe");
|
||||||
public static AuthMe authme;
|
public static AuthMe authme;
|
||||||
public Permission permission;
|
public Permission permission;
|
||||||
private static AuthMe instance;
|
|
||||||
private Utils utils = Utils.getInstance();
|
private Utils utils = Utils.getInstance();
|
||||||
private JavaPlugin plugin;
|
private JavaPlugin plugin;
|
||||||
private FileCache playerBackup = new FileCache();
|
private FileCache playerBackup = new FileCache();
|
||||||
@ -115,16 +112,15 @@ public class AuthMe extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
instance = this;
|
authme = this;
|
||||||
authme = instance;
|
|
||||||
|
|
||||||
authmeLogger.setParent(this.getLogger());
|
authmeLogger.setParent(this.getLogger());
|
||||||
|
|
||||||
citizens = new CitizensCommunicator(this);
|
|
||||||
|
|
||||||
settings = new Settings(this);
|
settings = new Settings(this);
|
||||||
settings.loadConfigOptions();
|
settings.loadConfigOptions();
|
||||||
|
|
||||||
|
citizens = new CitizensCommunicator(this);
|
||||||
|
|
||||||
if (Settings.enableAntiBot) {
|
if (Settings.enableAntiBot) {
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -275,13 +271,6 @@ public class AuthMe extends JavaPlugin {
|
|||||||
if (Settings.bungee) {
|
if (Settings.bungee) {
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||||
Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeCordMessage(this));
|
Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeCordMessage(this));
|
||||||
try {
|
|
||||||
if (Class.forName("net.md_5.bungee.api.event.ChatEvent") != null) {
|
|
||||||
pm.registerEvents(new AuthMeBungeeCordListener(database, this), this);
|
|
||||||
ConsoleLogger.info("Successfully hook with BungeeCord!");
|
|
||||||
}
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (pm.isPluginEnabled("Spout")) {
|
if (pm.isPluginEnabled("Spout")) {
|
||||||
pm.registerEvents(new AuthMeSpoutListener(database), this);
|
pm.registerEvents(new AuthMeSpoutListener(database), this);
|
||||||
@ -312,14 +301,10 @@ public class AuthMe extends JavaPlugin {
|
|||||||
|
|
||||||
if (Settings.reloadSupport)
|
if (Settings.reloadSupport)
|
||||||
try {
|
try {
|
||||||
if (!new File(getDataFolder() + File.separator + "players.yml").exists()) {
|
|
||||||
pllog = new PlayersLogs();
|
|
||||||
}
|
|
||||||
onReload();
|
onReload();
|
||||||
if (server.getOnlinePlayers().length < 1) {
|
if (server.getOnlinePlayers().length < 1) {
|
||||||
try {
|
try {
|
||||||
PlayersLogs.players.clear();
|
database.purgeLogged();
|
||||||
pllog.save();
|
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException npe) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -483,10 +468,9 @@ public class AuthMe extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
if (Bukkit.getOnlinePlayers().length != 0)
|
if (Bukkit.getOnlinePlayers().length != 0)
|
||||||
for(Player player : Bukkit.getOnlinePlayers()) {
|
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||||
this.savePlayer(player);
|
this.savePlayer(player);
|
||||||
}
|
}
|
||||||
pllog.save();
|
|
||||||
|
|
||||||
if (database != null) {
|
if (database != null) {
|
||||||
database.close();
|
database.close();
|
||||||
@ -497,25 +481,25 @@ public class AuthMe extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(Settings.isBackupActivated && Settings.isBackupOnStop) {
|
if(Settings.isBackupActivated && Settings.isBackupOnStop) {
|
||||||
Boolean Backup = new PerformBackup(this).DoBackup();
|
Boolean Backup = new PerformBackup(this).DoBackup();
|
||||||
if(Backup) ConsoleLogger.info("Backup Complete");
|
if(Backup) ConsoleLogger.info("Backup Complete");
|
||||||
else ConsoleLogger.showError("Error while making Backup");
|
else ConsoleLogger.showError("Error while making Backup");
|
||||||
}
|
}
|
||||||
ConsoleLogger.info("Authme " + this.getDescription().getVersion() + " disabled");
|
ConsoleLogger.info("Authme " + this.getDescription().getVersion() + " disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onReload() {
|
private void onReload() {
|
||||||
try {
|
try {
|
||||||
if (Bukkit.getServer().getOnlinePlayers() != null && !PlayersLogs.players.isEmpty()) {
|
if (Bukkit.getServer().getOnlinePlayers() != null) {
|
||||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
if (PlayersLogs.players.contains(player.getName())) {
|
if (database.isLogged(player.getName().toLowerCase())) {
|
||||||
String name = player.getName().toLowerCase();
|
String name = player.getName().toLowerCase();
|
||||||
PlayerAuth pAuth = database.getAuth(name);
|
PlayerAuth pAuth = database.getAuth(name);
|
||||||
if(pAuth == null)
|
if(pAuth == null)
|
||||||
break;
|
break;
|
||||||
PlayerAuth auth = new PlayerAuth(name, pAuth.getHash(), pAuth.getIp(), new Date().getTime(), pAuth.getEmail(), player.getName());
|
PlayerAuth auth = new PlayerAuth(name, pAuth.getHash(), pAuth.getIp(), new Date().getTime(), pAuth.getEmail(), player.getName());
|
||||||
database.updateSession(auth);
|
database.updateSession(auth);
|
||||||
PlayerCache.getInstance().addPlayer(auth);
|
PlayerCache.getInstance().addPlayer(auth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -526,7 +510,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static AuthMe getInstance() {
|
public static AuthMe getInstance() {
|
||||||
return instance;
|
return authme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void savePlayer(Player player) throws IllegalStateException, NullPointerException {
|
public void savePlayer(Player player) throws IllegalStateException, NullPointerException {
|
||||||
@ -561,6 +545,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerCache.getInstance().removePlayer(name);
|
PlayerCache.getInstance().removePlayer(name);
|
||||||
|
database.setUnlogged(name);
|
||||||
player.saveData();
|
player.saveData();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
}
|
}
|
||||||
@ -636,23 +621,8 @@ public class AuthMe extends JavaPlugin {
|
|||||||
purgeLimitedCreative(cleared);
|
purgeLimitedCreative(cleared);
|
||||||
if (Settings.purgeAntiXray)
|
if (Settings.purgeAntiXray)
|
||||||
purgeAntiXray(cleared);
|
purgeAntiXray(cleared);
|
||||||
//if (Settings.purgePermissions && permission != null)
|
|
||||||
//purgePerms(cleared);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private void purgePerms(List<String> cleared) {
|
|
||||||
int i = 0;
|
|
||||||
for (String name : cleared) {
|
|
||||||
org.bukkit.OfflinePlayer player = Bukkit.getOfflinePlayer(name);
|
|
||||||
if (player == null) continue;
|
|
||||||
String playerName = player.getName();
|
|
||||||
for (String group : permission.getPlayerGroups((String) null, playerName)) {
|
|
||||||
permission.playerRemoveGroup((String) null, playerName, group);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " players permissions");
|
|
||||||
} */
|
|
||||||
|
|
||||||
public void purgeAntiXray(List<String> cleared) {
|
public void purgeAntiXray(List<String> cleared) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String name : cleared) {
|
for (String name : cleared) {
|
||||||
@ -720,28 +690,59 @@ public class AuthMe extends JavaPlugin {
|
|||||||
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " EssentialsFiles");
|
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " EssentialsFiles");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getSpawnLocation(String name, World world) {
|
public Location getSpawnLocation(Player player, World world) {
|
||||||
|
String[] spawnPriority = Settings.spawnPriority.split(",");
|
||||||
Location spawnLoc = world.getSpawnLocation();
|
Location spawnLoc = world.getSpawnLocation();
|
||||||
|
int i = 3;
|
||||||
|
for (i = 3 ; i >= 0 ; i--) {
|
||||||
|
String s = spawnPriority[i];
|
||||||
|
if (s.equalsIgnoreCase("default") && getDefaultSpawn(world) != null)
|
||||||
|
spawnLoc = getDefaultSpawn(world);
|
||||||
|
if (s.equalsIgnoreCase("multiverse") && getMultiverseSpawn(world) != null)
|
||||||
|
spawnLoc = getMultiverseSpawn(world);
|
||||||
|
if (s.equalsIgnoreCase("essentials") && getEssentialsSpawn() != null)
|
||||||
|
spawnLoc = getEssentialsSpawn();
|
||||||
|
if (s.equalsIgnoreCase("authme") && getAuthMeSpawn(player) != null)
|
||||||
|
spawnLoc = getAuthMeSpawn(player);
|
||||||
|
}
|
||||||
|
if (spawnLoc == null)
|
||||||
|
spawnLoc = world.getSpawnLocation();
|
||||||
|
return spawnLoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Location getDefaultSpawn(World world) {
|
||||||
|
return world.getSpawnLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Location getMultiverseSpawn(World world) {
|
||||||
if (multiverse != null && Settings.multiverse) {
|
if (multiverse != null && Settings.multiverse) {
|
||||||
try {
|
try {
|
||||||
spawnLoc = multiverse.getMVWorldManager().getMVWorld(world).getSpawnLocation();
|
return multiverse.getMVWorldManager().getMVWorld(world).getSpawnLocation();
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException npe) {
|
||||||
} catch (ClassCastException cce) {
|
} catch (ClassCastException cce) {
|
||||||
} catch (NoClassDefFoundError ncdfe) {
|
} catch (NoClassDefFoundError ncdfe) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Location getEssentialsSpawn() {
|
||||||
if (essentialsSpawn != null) {
|
if (essentialsSpawn != null) {
|
||||||
spawnLoc = essentialsSpawn;
|
return essentialsSpawn;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Location getAuthMeSpawn(Player player) {
|
||||||
|
if ((!database.isAuthAvailable(player.getName().toLowerCase()) || !player.hasPlayedBefore()) && Spawn.getInstance().getFirstSpawn() != null)
|
||||||
|
return Spawn.getInstance().getFirstSpawn();
|
||||||
if (Spawn.getInstance().getSpawn() != null)
|
if (Spawn.getInstance().getSpawn() != null)
|
||||||
spawnLoc = Spawn.getInstance().getSpawn();
|
return Spawn.getInstance().getSpawn();
|
||||||
if (!database.isAuthAvailable(name) && Spawn.getInstance().getFirstSpawn() != null)
|
return null;
|
||||||
spawnLoc = Spawn.getInstance().getFirstSpawn();
|
|
||||||
return spawnLoc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void downloadGeoIp() {
|
public void downloadGeoIp() {
|
||||||
ConsoleLogger.info(" This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com");
|
ConsoleLogger.info("LICENSE : This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com");
|
||||||
File file = new File(getDataFolder(), "GeoIP.dat");
|
File file = new File(getDataFolder(), "GeoIP.dat");
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
try {
|
try {
|
||||||
@ -829,4 +830,29 @@ public class AuthMe extends JavaPlugin {
|
|||||||
} catch (Exception e) {}
|
} catch (Exception e) {}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getIP(Player player, String name) {
|
||||||
|
String ip = player.getAddress().getAddress().getHostAddress();
|
||||||
|
if (Settings.bungee) {
|
||||||
|
if (realIp.containsKey(name))
|
||||||
|
ip = realIp.get(name);
|
||||||
|
}
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLoggedIp(String ip) {
|
||||||
|
for (Player player : this.getServer().getOnlinePlayers()) {
|
||||||
|
if(ip.equalsIgnoreCase(getIP(player, player.getName())) && database.isLogged(player.getName().toLowerCase()))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasJoinedIp(String ip) {
|
||||||
|
for (Player player : this.getServer().getOnlinePlayers()) {
|
||||||
|
if(ip.equalsIgnoreCase(getIP(player, player.getName())))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,68 +22,68 @@ import fr.xephi.authme.settings.Settings;
|
|||||||
*/
|
*/
|
||||||
public class SendMailSSL {
|
public class SendMailSSL {
|
||||||
|
|
||||||
public AuthMe instance;
|
public AuthMe plugin;
|
||||||
|
|
||||||
public SendMailSSL(AuthMe instance) {
|
public SendMailSSL(AuthMe plugin) {
|
||||||
this.instance = instance;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void main(final PlayerAuth auth, final String newPass) {
|
public void main(final PlayerAuth auth, final String newPass) {
|
||||||
|
String sendername;
|
||||||
|
|
||||||
String sendername;
|
if (Settings.getmailSenderName.isEmpty() || Settings.getmailSenderName == null) {
|
||||||
|
sendername = Settings.getmailAccount;
|
||||||
|
} else {
|
||||||
|
sendername = Settings.getmailSenderName;
|
||||||
|
}
|
||||||
|
|
||||||
if (Settings.getmailSenderName.isEmpty() || Settings.getmailSenderName == null) {
|
Properties props = new Properties();
|
||||||
sendername = Settings.getmailAccount;
|
props.put("mail.smtp.host", Settings.getmailSMTP);
|
||||||
} else {
|
props.put("mail.smtp.socketFactory.port", String.valueOf(Settings.getMailPort));
|
||||||
sendername = Settings.getmailSenderName;
|
props.put("mail.smtp.socketFactory.class",
|
||||||
|
"javax.net.ssl.SSLSocketFactory");
|
||||||
|
props.put("mail.smtp.auth", "true");
|
||||||
|
props.put("mail.smtp.port", String.valueOf(Settings.getMailPort));
|
||||||
|
|
||||||
|
Session session = Session.getInstance(props,
|
||||||
|
new javax.mail.Authenticator() {
|
||||||
|
protected PasswordAuthentication getPasswordAuthentication() {
|
||||||
|
return new PasswordAuthentication(Settings.getmailAccount,Settings.getmailPassword);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Properties props = new Properties();
|
try {
|
||||||
props.put("mail.smtp.host", Settings.getmailSMTP);
|
|
||||||
props.put("mail.smtp.socketFactory.port", String.valueOf(Settings.getMailPort));
|
|
||||||
props.put("mail.smtp.socketFactory.class",
|
|
||||||
"javax.net.ssl.SSLSocketFactory");
|
|
||||||
props.put("mail.smtp.auth", "true");
|
|
||||||
props.put("mail.smtp.port", String.valueOf(Settings.getMailPort));
|
|
||||||
|
|
||||||
Session session = Session.getInstance(props,
|
final Message message = new MimeMessage(session);
|
||||||
new javax.mail.Authenticator() {
|
try {
|
||||||
protected PasswordAuthentication getPasswordAuthentication() {
|
message.setFrom(new InternetAddress(Settings.getmailAccount, sendername));
|
||||||
return new PasswordAuthentication(Settings.getmailAccount,Settings.getmailPassword);
|
} catch (UnsupportedEncodingException uee) {
|
||||||
}
|
message.setFrom(new InternetAddress(Settings.getmailAccount));
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
final Message message = new MimeMessage(session);
|
|
||||||
try {
|
|
||||||
message.setFrom(new InternetAddress(Settings.getmailAccount, sendername));
|
|
||||||
} catch (UnsupportedEncodingException uee) {
|
|
||||||
message.setFrom(new InternetAddress(Settings.getmailAccount));
|
|
||||||
}
|
|
||||||
message.setRecipients(Message.RecipientType.TO,
|
|
||||||
InternetAddress.parse(auth.getEmail()));
|
|
||||||
message.setSubject(Settings.getMailSubject);
|
|
||||||
message.setSentDate(new Date());
|
|
||||||
String text = Settings.getMailText;
|
|
||||||
text = text.replaceAll("<playername>", auth.getNickname());
|
|
||||||
text = text.replaceAll("<servername>", instance.getServer().getServerName());
|
|
||||||
text = text.replaceAll("<generatedpass>", newPass);
|
|
||||||
message.setContent(text, "text/html");
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(instance, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
Transport.send(message);
|
|
||||||
} catch (MessagingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if(!Settings.noConsoleSpam)
|
|
||||||
ConsoleLogger.info("Email sent to : " + auth.getNickname());
|
|
||||||
} catch (MessagingException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
message.setRecipients(Message.RecipientType.TO,
|
||||||
|
InternetAddress.parse(auth.getEmail()));
|
||||||
|
message.setSubject(Settings.getMailSubject);
|
||||||
|
message.setSentDate(new Date());
|
||||||
|
String text = Settings.getMailText;
|
||||||
|
text = text.replace("<playername>", auth.getNickname());
|
||||||
|
text = text.replace("<servername>", plugin.getServer().getServerName());
|
||||||
|
text = text.replace("<generatedpass>", newPass);
|
||||||
|
message.setContent(text, "text/html");
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
Transport.send(message);
|
||||||
|
} catch (MessagingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(!Settings.noConsoleSpam)
|
||||||
|
ConsoleLogger.info("Email sent to : " + auth.getNickname());
|
||||||
|
} catch (MessagingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,29 +49,29 @@ public class Utils {
|
|||||||
String name = player;
|
String name = player;
|
||||||
switch(group) {
|
switch(group) {
|
||||||
case UNREGISTERED: {
|
case UNREGISTERED: {
|
||||||
plugin.permission.playerRemoveGroup(world, name, currentGroup);
|
plugin.permission.playerRemoveGroup(world, name, currentGroup);
|
||||||
plugin.permission.playerAddGroup(world, name, Settings.unRegisteredGroup);
|
plugin.permission.playerAddGroup(world, name, Settings.unRegisteredGroup);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case REGISTERED: {
|
case REGISTERED: {
|
||||||
plugin.permission.playerRemoveGroup(world, name, currentGroup);
|
plugin.permission.playerRemoveGroup(world, name, currentGroup);
|
||||||
plugin.permission.playerAddGroup(world, name, Settings.getRegisteredGroup);
|
plugin.permission.playerAddGroup(world, name, Settings.getRegisteredGroup);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NOTLOGGEDIN: {
|
case NOTLOGGEDIN: {
|
||||||
if(!useGroupSystem()) break;
|
if(!useGroupSystem()) break;
|
||||||
plugin.permission.playerRemoveGroup(world, name, currentGroup);
|
plugin.permission.playerRemoveGroup(world, name, currentGroup);
|
||||||
plugin.permission.playerAddGroup(world, name, Settings.getUnloggedinGroup);
|
plugin.permission.playerAddGroup(world, name, Settings.getUnloggedinGroup);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LOGGEDIN: {
|
case LOGGEDIN: {
|
||||||
if(!useGroupSystem()) break;
|
if(!useGroupSystem()) break;
|
||||||
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name.toLowerCase());
|
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name.toLowerCase());
|
||||||
if (limbo == null) break;
|
if (limbo == null) break;
|
||||||
String realGroup = limbo.getGroup();
|
String realGroup = limbo.getGroup();
|
||||||
plugin.permission.playerRemoveGroup(world, name, currentGroup);
|
plugin.permission.playerRemoveGroup(world, name, currentGroup);
|
||||||
plugin.permission.playerAddGroup(world, name, realGroup);
|
plugin.permission.playerAddGroup(world, name, realGroup);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -97,6 +97,12 @@ public class PlayerAuth {
|
|||||||
this.realName = realName;
|
this.realName = realName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PlayerAuth(String nickname, String ip, long lastLogin) {
|
||||||
|
this.nickname = nickname;
|
||||||
|
this.ip = ip;
|
||||||
|
this.lastLogin = lastLogin;
|
||||||
|
}
|
||||||
|
|
||||||
public String getIp() {
|
public String getIp() {
|
||||||
if (ip == null || ip.isEmpty())
|
if (ip == null || ip.isEmpty())
|
||||||
ip = "127.0.0.1";
|
ip = "127.0.0.1";
|
||||||
|
|||||||
@ -89,7 +89,7 @@ public class LimboCache {
|
|||||||
gameMode = GameMode.SURVIVAL;
|
gameMode = GameMode.SURVIVAL;
|
||||||
}
|
}
|
||||||
if(player.isDead()) {
|
if(player.isDead()) {
|
||||||
loc = plugin.getSpawnLocation(player.getName().toLowerCase(), player.getWorld());
|
loc = plugin.getSpawnLocation(player, player.getWorld());
|
||||||
}
|
}
|
||||||
cache.put(player.getName().toLowerCase(), new LimboPlayer(name, loc, inv, arm, gameMode, operator, playerGroup, flying));
|
cache.put(player.getName().toLowerCase(), new LimboPlayer(name, loc, inv, arm, gameMode, operator, playerGroup, flying));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -179,11 +179,11 @@ public class AdminCommand implements CommandExecutor {
|
|||||||
sender.sendMessage("[AuthMe] The player : " + player.getNickname() + " is unlogged since " + msg);
|
sender.sendMessage("[AuthMe] The player : " + player.getNickname() + " is unlogged since " + msg);
|
||||||
sender.sendMessage("[AuthMe] LastPlayer IP : " + lastIP);
|
sender.sendMessage("[AuthMe] LastPlayer IP : " + lastIP);
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("This player does not exist");
|
m._(sender, "unknown_user");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
sender.sendMessage("This player does not exist");
|
m._(sender, "unknown_user");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (args[0].equalsIgnoreCase("accounts")) {
|
} else if (args[0].equalsIgnoreCase("accounts")) {
|
||||||
@ -344,7 +344,7 @@ public class AdminCommand implements CommandExecutor {
|
|||||||
String playername = args[1].toLowerCase();
|
String playername = args[1].toLowerCase();
|
||||||
PlayerAuth getAuth = database.getAuth(playername);
|
PlayerAuth getAuth = database.getAuth(playername);
|
||||||
if (getAuth == null) {
|
if (getAuth == null) {
|
||||||
sender.sendMessage("This player does not exist");
|
m._(sender, "unknown_user");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
sender.sendMessage("[AuthMe] " + args[1] + " email : " + getAuth.getEmail());
|
sender.sendMessage("[AuthMe] " + args[1] + " email : " + getAuth.getEmail());
|
||||||
@ -357,7 +357,7 @@ public class AdminCommand implements CommandExecutor {
|
|||||||
String playername = args[1].toLowerCase();
|
String playername = args[1].toLowerCase();
|
||||||
PlayerAuth getAuth = database.getAuth(playername);
|
PlayerAuth getAuth = database.getAuth(playername);
|
||||||
if (getAuth == null) {
|
if (getAuth == null) {
|
||||||
sender.sendMessage("This player does not exist");
|
m._(sender, "unknown_user");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
getAuth.setEmail(args[2]);
|
getAuth.setEmail(args[2]);
|
||||||
@ -506,7 +506,7 @@ public class AdminCommand implements CommandExecutor {
|
|||||||
if (target != null) {
|
if (target != null) {
|
||||||
if (target.isOnline()) {
|
if (target.isOnline()) {
|
||||||
if (Settings.isTeleportToSpawnEnabled) {
|
if (Settings.isTeleportToSpawnEnabled) {
|
||||||
Location spawn = plugin.getSpawnLocation(name, target.getWorld());
|
Location spawn = plugin.getSpawnLocation(target, target.getWorld());
|
||||||
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()) {
|
||||||
|
|||||||
@ -92,9 +92,13 @@ public class EmailCommand implements CommandExecutor {
|
|||||||
m._(player, "reg_email_msg");
|
m._(player, "reg_email_msg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(args[0].equalsIgnoreCase("change") && args.length == 3 ) {
|
} else if(args[0].equalsIgnoreCase("change")) {
|
||||||
|
if (args.length != 3) {
|
||||||
|
m._(player, "usage_email_change");
|
||||||
|
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") && data.getAllAuthsByEmail(args[2]).size() >= Settings.getmaxRegPerEmail) {
|
||||||
m._(player, "max_reg");
|
m._(player, "max_reg");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,6 @@ 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.events.AuthMeTeleportEvent;
|
||||||
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;
|
||||||
@ -30,7 +29,6 @@ import fr.xephi.authme.task.TimeoutTask;
|
|||||||
public class LogoutCommand implements CommandExecutor {
|
public class LogoutCommand implements CommandExecutor {
|
||||||
|
|
||||||
private Messages m = Messages.getInstance();
|
private Messages m = Messages.getInstance();
|
||||||
private PlayersLogs pllog = PlayersLogs.getInstance();
|
|
||||||
private AuthMe plugin;
|
private AuthMe plugin;
|
||||||
private DataSource database;
|
private DataSource database;
|
||||||
private Utils utils = Utils.getInstance();
|
private Utils utils = Utils.getInstance();
|
||||||
@ -61,7 +59,6 @@ public class LogoutCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlayerAuth auth = PlayerCache.getInstance().getAuth(name);
|
PlayerAuth auth = PlayerCache.getInstance().getAuth(name);
|
||||||
auth.setIp("198.18.0.1");
|
|
||||||
database.updateSession(auth);
|
database.updateSession(auth);
|
||||||
auth.setQuitLocX(player.getLocation().getX());
|
auth.setQuitLocX(player.getLocation().getX());
|
||||||
auth.setQuitLocY(player.getLocation().getY());
|
auth.setQuitLocY(player.getLocation().getY());
|
||||||
@ -70,9 +67,10 @@ public class LogoutCommand implements CommandExecutor {
|
|||||||
database.updateQuitLoc(auth);
|
database.updateQuitLoc(auth);
|
||||||
|
|
||||||
PlayerCache.getInstance().removePlayer(name);
|
PlayerCache.getInstance().removePlayer(name);
|
||||||
|
database.setUnlogged(name);
|
||||||
|
|
||||||
if (Settings.isTeleportToSpawnEnabled) {
|
if (Settings.isTeleportToSpawnEnabled) {
|
||||||
Location spawnLoc = plugin.getSpawnLocation(name, player.getWorld());
|
Location spawnLoc = plugin.getSpawnLocation(player, player.getWorld());
|
||||||
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, spawnLoc);
|
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, spawnLoc);
|
||||||
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
||||||
if(!tpEvent.isCancelled()) {
|
if(!tpEvent.isCancelled()) {
|
||||||
@ -104,10 +102,6 @@ public class LogoutCommand implements CommandExecutor {
|
|||||||
int msgT = sched.scheduleSyncDelayedTask(plugin, new MessageTask(plugin, name, m._("login_msg"), interval));
|
int msgT = sched.scheduleSyncDelayedTask(plugin, new MessageTask(plugin, name, m._("login_msg"), interval));
|
||||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT);
|
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT);
|
||||||
try {
|
try {
|
||||||
if (PlayersLogs.players.contains(player.getName())) {
|
|
||||||
PlayersLogs.players.remove(player.getName());
|
|
||||||
pllog.save();
|
|
||||||
}
|
|
||||||
if (player.isInsideVehicle())
|
if (player.isInsideVehicle())
|
||||||
player.getVehicle().eject();
|
player.getVehicle().eject();
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException npe) {
|
||||||
|
|||||||
@ -23,7 +23,6 @@ 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;
|
||||||
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;
|
||||||
@ -32,7 +31,6 @@ import fr.xephi.authme.task.TimeoutTask;
|
|||||||
public class UnregisterCommand implements CommandExecutor {
|
public class UnregisterCommand implements CommandExecutor {
|
||||||
|
|
||||||
private Messages m = Messages.getInstance();
|
private Messages m = Messages.getInstance();
|
||||||
private PlayersLogs pllog = PlayersLogs.getInstance();
|
|
||||||
public AuthMe plugin;
|
public AuthMe plugin;
|
||||||
private DataSource database;
|
private DataSource database;
|
||||||
private FileCache playerCache = new FileCache();
|
private FileCache playerCache = new FileCache();
|
||||||
@ -73,7 +71,7 @@ public class UnregisterCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
if(Settings.isForcedRegistrationEnabled) {
|
if(Settings.isForcedRegistrationEnabled) {
|
||||||
if (Settings.isTeleportToSpawnEnabled) {
|
if (Settings.isTeleportToSpawnEnabled) {
|
||||||
Location spawn = plugin.getSpawnLocation(name, player.getWorld());
|
Location spawn = plugin.getSpawnLocation(player, player.getWorld());
|
||||||
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawn, false);
|
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawn, false);
|
||||||
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
||||||
if(!tpEvent.isCancelled()) {
|
if(!tpEvent.isCancelled()) {
|
||||||
@ -110,17 +108,13 @@ public class UnregisterCommand implements CommandExecutor {
|
|||||||
if(playerCache.doesCacheExist(name)) {
|
if(playerCache.doesCacheExist(name)) {
|
||||||
playerCache.removeCache(name);
|
playerCache.removeCache(name);
|
||||||
}
|
}
|
||||||
if (PlayersLogs.players.contains(player.getName())) {
|
|
||||||
PlayersLogs.players.remove(player.getName());
|
|
||||||
pllog.save();
|
|
||||||
}
|
|
||||||
m._(player, "unregistered");
|
m._(player, "unregistered");
|
||||||
ConsoleLogger.info(player.getDisplayName() + " unregistered himself");
|
ConsoleLogger.info(player.getDisplayName() + " unregistered himself");
|
||||||
if(plugin.notifications != null) {
|
if(plugin.notifications != null) {
|
||||||
plugin.notifications.showNotification(new Notification("[AuthMe] " + player.getName() + " unregistered himself!"));
|
plugin.notifications.showNotification(new Notification("[AuthMe] " + player.getName() + " unregistered himself!"));
|
||||||
}
|
}
|
||||||
if (Settings.isTeleportToSpawnEnabled) {
|
if (Settings.isTeleportToSpawnEnabled) {
|
||||||
Location spawn = plugin.getSpawnLocation(name, player.getWorld());
|
Location spawn = plugin.getSpawnLocation(player, player.getWorld());
|
||||||
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawn, false);
|
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawn, false);
|
||||||
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
||||||
if(!tpEvent.isCancelled()) {
|
if(!tpEvent.isCancelled()) {
|
||||||
|
|||||||
@ -191,4 +191,28 @@ public class CacheDataSource implements DataSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSourceType getType() {
|
||||||
|
return source.getType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLogged(String user) {
|
||||||
|
return source.isLogged(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLogged(String user) {
|
||||||
|
source.setLogged(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUnlogged(String user) {
|
||||||
|
source.setUnlogged(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void purgeLogged() {
|
||||||
|
source.purgeLogged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,5 +47,15 @@ public interface DataSource {
|
|||||||
void reload();
|
void reload();
|
||||||
|
|
||||||
void purgeBanned(List<String> banned);
|
void purgeBanned(List<String> banned);
|
||||||
|
|
||||||
|
DataSourceType getType();
|
||||||
|
|
||||||
|
boolean isLogged(String user);
|
||||||
|
|
||||||
|
void setLogged(String user);
|
||||||
|
|
||||||
|
void setUnlogged(String user);
|
||||||
|
|
||||||
|
void purgeLogged();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import java.util.List;
|
|||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.api.API;
|
import fr.xephi.authme.api.API;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
|
import fr.xephi.authme.settings.PlayersLogs;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
|
||||||
|
|
||||||
@ -629,4 +630,29 @@ public class FileDataSource implements DataSource {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSourceType getType() {
|
||||||
|
return DataSourceType.FILE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLogged(String user) {
|
||||||
|
return PlayersLogs.getInstance().players.contains(user.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLogged(String user) {
|
||||||
|
PlayersLogs.getInstance().addPlayer(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUnlogged(String user) {
|
||||||
|
PlayersLogs.getInstance().removePlayer(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void purgeLogged() {
|
||||||
|
PlayersLogs.getInstance().clear();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,6 +39,7 @@ public class MySQLDataSource implements DataSource {
|
|||||||
private String lastlocWorld;
|
private String lastlocWorld;
|
||||||
private String columnEmail;
|
private String columnEmail;
|
||||||
private String columnID;
|
private String columnID;
|
||||||
|
private String columnLogged;
|
||||||
private List<String> columnOthers;
|
private List<String> columnOthers;
|
||||||
private MiniConnectionPoolManager conPool;
|
private MiniConnectionPoolManager conPool;
|
||||||
|
|
||||||
@ -62,6 +63,7 @@ public class MySQLDataSource implements DataSource {
|
|||||||
this.columnEmail = Settings.getMySQLColumnEmail;
|
this.columnEmail = Settings.getMySQLColumnEmail;
|
||||||
this.columnOthers = Settings.getMySQLOtherUsernameColumn;
|
this.columnOthers = Settings.getMySQLOtherUsernameColumn;
|
||||||
this.columnID = Settings.getMySQLColumnId;
|
this.columnID = Settings.getMySQLColumnId;
|
||||||
|
this.columnLogged = Settings.getMySQLColumnLogged;
|
||||||
|
|
||||||
connect();
|
connect();
|
||||||
setup();
|
setup();
|
||||||
@ -91,13 +93,14 @@ public class MySQLDataSource implements DataSource {
|
|||||||
+ columnID + " INTEGER AUTO_INCREMENT,"
|
+ columnID + " INTEGER AUTO_INCREMENT,"
|
||||||
+ columnName + " VARCHAR(255) NOT NULL UNIQUE,"
|
+ columnName + " VARCHAR(255) NOT NULL UNIQUE,"
|
||||||
+ columnPassword + " VARCHAR(255) NOT NULL,"
|
+ columnPassword + " VARCHAR(255) NOT NULL,"
|
||||||
+ columnIp + " VARCHAR(40) NOT NULL,"
|
+ columnIp + " VARCHAR(40) NOT NULL DEFAULT '127.0.0.1',"
|
||||||
+ columnLastLogin + " BIGINT,"
|
+ columnLastLogin + " BIGINT DEFAULT '0',"
|
||||||
+ lastlocX + " DOUBLE NOT NULL DEFAULT '0.0',"
|
+ lastlocX + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocY + " DOUBLE NOT NULL DEFAULT '0.0',"
|
+ lastlocY + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0',"
|
+ lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocWorld + " VARCHAR(255) DEFAULT 'world',"
|
+ lastlocWorld + " VARCHAR(255) DEFAULT 'world',"
|
||||||
+ columnEmail + " VARCHAR(255) DEFAULT 'your@email.com',"
|
+ columnEmail + " VARCHAR(255) DEFAULT 'your@email.com',"
|
||||||
|
+ columnLogged + " SMALLINT NOT NULL DEFAULT '0',"
|
||||||
+ "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));");
|
+ "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));");
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, columnPassword);
|
rs = con.getMetaData().getColumns(null, null, tableName, columnPassword);
|
||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
@ -108,13 +111,13 @@ public class MySQLDataSource implements DataSource {
|
|||||||
rs = con.getMetaData().getColumns(null, null, tableName, columnIp);
|
rs = con.getMetaData().getColumns(null, null, tableName, columnIp);
|
||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN "
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN "
|
||||||
+ columnIp + " VARCHAR(40) NOT NULL;");
|
+ columnIp + " VARCHAR(40) NOT NULL DEFAULT '127.0.0.1';");
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, columnLastLogin);
|
rs = con.getMetaData().getColumns(null, null, tableName, columnLastLogin);
|
||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN "
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN "
|
||||||
+ columnLastLogin + " BIGINT;");
|
+ columnLastLogin + " BIGINT DEFAULT '0';");
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
||||||
@ -130,7 +133,12 @@ public class MySQLDataSource implements DataSource {
|
|||||||
rs.close();
|
rs.close();
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, columnEmail);
|
rs = con.getMetaData().getColumns(null, null, tableName, columnEmail);
|
||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com' AFTER " + lastlocZ +";");
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com' AFTER " + lastlocWorld +";");
|
||||||
|
}
|
||||||
|
rs.close();
|
||||||
|
rs = con.getMetaData().getColumns(null, null, tableName, columnLogged);
|
||||||
|
if (!rs.next()) {
|
||||||
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnLogged + " SMALLINT NOT NULL DEFAULT '0' AFTER " + columnEmail +";");
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
||||||
@ -731,7 +739,7 @@ public class MySQLDataSource implements DataSource {
|
|||||||
close(rs);
|
close(rs);
|
||||||
close(pst);
|
close(pst);
|
||||||
close(con);
|
close(con);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -806,4 +814,105 @@ public class MySQLDataSource implements DataSource {
|
|||||||
ConsoleLogger.info("ConnectionPool was unavailable... Reconnected!");
|
ConsoleLogger.info("ConnectionPool was unavailable... Reconnected!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSourceType getType() {
|
||||||
|
return DataSourceType.MYSQL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLogged(String user) {
|
||||||
|
Connection con = null;
|
||||||
|
PreparedStatement pst = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
try {
|
||||||
|
con = makeSureConnectionIsReady();
|
||||||
|
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE "
|
||||||
|
+ 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;
|
||||||
|
} catch (TimeoutException 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 = makeSureConnectionIsReady();
|
||||||
|
pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE " + columnName + "=?;");
|
||||||
|
pst.setInt(1, 1);
|
||||||
|
pst.setString(2, user);
|
||||||
|
pst.executeUpdate();
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
|
return;
|
||||||
|
} catch (TimeoutException ex) {
|
||||||
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
|
return;
|
||||||
|
} finally {
|
||||||
|
close(pst);
|
||||||
|
close(con);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUnlogged(String user) {
|
||||||
|
Connection con = null;
|
||||||
|
PreparedStatement pst = null;
|
||||||
|
try {
|
||||||
|
con = makeSureConnectionIsReady();
|
||||||
|
pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE " + columnName + "=?;");
|
||||||
|
pst.setInt(1, 0);
|
||||||
|
pst.setString(2, user);
|
||||||
|
pst.executeUpdate();
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
|
return;
|
||||||
|
} catch (TimeoutException ex) {
|
||||||
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
|
return;
|
||||||
|
} finally {
|
||||||
|
close(pst);
|
||||||
|
close(con);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void purgeLogged() {
|
||||||
|
Connection con = null;
|
||||||
|
PreparedStatement pst = null;
|
||||||
|
try {
|
||||||
|
con = makeSureConnectionIsReady();
|
||||||
|
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());
|
||||||
|
return;
|
||||||
|
} catch (TimeoutException ex) {
|
||||||
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
|
return;
|
||||||
|
} finally {
|
||||||
|
close(pst);
|
||||||
|
close(con);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import fr.xephi.authme.ConsoleLogger;
|
|||||||
import fr.xephi.authme.api.API;
|
import fr.xephi.authme.api.API;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.datasource.MiniConnectionPoolManager.TimeoutException;
|
import fr.xephi.authme.datasource.MiniConnectionPoolManager.TimeoutException;
|
||||||
|
import fr.xephi.authme.settings.PlayersLogs;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -509,4 +510,28 @@ public class SqliteDataSource implements DataSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSourceType getType() {
|
||||||
|
return DataSourceType.SQLITE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLogged(String user) {
|
||||||
|
return PlayersLogs.getInstance().players.contains(user.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLogged(String user) {
|
||||||
|
PlayersLogs.getInstance().addPlayer(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUnlogged(String user) {
|
||||||
|
PlayersLogs.getInstance().removePlayer(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void purgeLogged() {
|
||||||
|
PlayersLogs.getInstance().clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,67 +0,0 @@
|
|||||||
package fr.xephi.authme.listener;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.event.ChatEvent;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
|
||||||
import fr.xephi.authme.Utils;
|
|
||||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
|
||||||
import fr.xephi.authme.settings.Settings;
|
|
||||||
|
|
||||||
|
|
||||||
public class AuthMeBungeeCordListener implements Listener {
|
|
||||||
private DataSource data;
|
|
||||||
private AuthMe plugin;
|
|
||||||
|
|
||||||
public AuthMeBungeeCordListener(DataSource data, AuthMe plugin) {
|
|
||||||
this.data = data;
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.LOWEST)
|
|
||||||
public void onBungeeChatEvent(ChatEvent event) {
|
|
||||||
if (!Settings.bungee) return;
|
|
||||||
if (event.isCancelled()) return;
|
|
||||||
if (!event.isCommand()) return;
|
|
||||||
Player player = null;
|
|
||||||
try {
|
|
||||||
for (String p : plugin.realIp.keySet()) {
|
|
||||||
Player pl = Bukkit.getPlayer(p);
|
|
||||||
if (pl != null) {
|
|
||||||
if (plugin.realIp.get(p).equalsIgnoreCase(event.getSender().getAddress().getAddress().getHostAddress()))
|
|
||||||
player = pl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {}
|
|
||||||
if (player == null) {
|
|
||||||
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
|
|
||||||
if (p.getAddress().getAddress().equals(event.getSender().getAddress().getAddress())) {
|
|
||||||
player = p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String name = player.getName().toLowerCase();
|
|
||||||
|
|
||||||
if (Utils.getInstance().isUnrestricted(player)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!data.isAuthAvailable(name)) {
|
|
||||||
if (!Settings.isForcedRegistrationEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.setMessage("/unreacheablecommand");
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -56,7 +56,6 @@ import fr.xephi.authme.events.SessionEvent;
|
|||||||
import fr.xephi.authme.events.SpawnTeleportEvent;
|
import fr.xephi.authme.events.SpawnTeleportEvent;
|
||||||
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.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;
|
||||||
@ -366,7 +365,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int radius = Settings.getMovementRadius;
|
int radius = Settings.getMovementRadius;
|
||||||
Location spawn = plugin.getSpawnLocation(name, player.getWorld());
|
Location spawn = plugin.getSpawnLocation(player, player.getWorld());
|
||||||
|
|
||||||
if (!event.getPlayer().getWorld().equals(spawn.getWorld())) {
|
if (!event.getPlayer().getWorld().equals(spawn.getWorld())) {
|
||||||
event.getPlayer().teleport(spawn);
|
event.getPlayer().teleport(spawn);
|
||||||
@ -543,7 +542,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
World world = player.getWorld();
|
World world = player.getWorld();
|
||||||
final String name = player.getName().toLowerCase();
|
final String name = player.getName().toLowerCase();
|
||||||
Location spawnLoc = plugin.getSpawnLocation(name, world);
|
Location spawnLoc = plugin.getSpawnLocation(player, world);
|
||||||
gm = player.getGameMode();
|
gm = player.getGameMode();
|
||||||
gameMode.put(name, gm);
|
gameMode.put(name, gm);
|
||||||
BukkitScheduler sched = plugin.getServer().getScheduler();
|
BukkitScheduler sched = plugin.getServer().getScheduler();
|
||||||
@ -563,16 +562,22 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
if (plugin.realIp.containsKey(name))
|
if (plugin.realIp.containsKey(name))
|
||||||
ip = plugin.realIp.get(name);
|
ip = plugin.realIp.get(name);
|
||||||
}
|
}
|
||||||
if(Settings.isAllowRestrictedIp && !Settings.getRestrictedIp(name, ip)) {
|
if(Settings.isAllowRestrictedIp && !Settings.getRestrictedIp(name, ip)) {
|
||||||
GameMode gM = gameMode.get(name);
|
GameMode gM = gameMode.get(name);
|
||||||
this.causeByAuthMe = true;
|
this.causeByAuthMe = true;
|
||||||
player.setGameMode(gM);
|
player.setGameMode(gM);
|
||||||
this.causeByAuthMe = false;
|
this.causeByAuthMe = false;
|
||||||
player.kickPlayer("You are not the Owner of this account, please try another name!");
|
player.kickPlayer("You are not the Owner of this account, please try another name!");
|
||||||
if (Settings.banUnsafeIp)
|
if (Settings.banUnsafeIp)
|
||||||
plugin.getServer().banIP(ip);
|
plugin.getServer().banIP(ip);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(Settings.getMaxJoinPerIp > 0 && !plugin.authmePermissible(player, "authme.allow2accounts") && !ip.equalsIgnoreCase("127.0.0.1") && !ip.equalsIgnoreCase("localhost")) {
|
||||||
|
if (plugin.hasJoinedIp(ip)) {
|
||||||
|
player.kickPlayer("A player with the same IP is already in game!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (data.isAuthAvailable(name)) {
|
if (data.isAuthAvailable(name)) {
|
||||||
if (Settings.isSessionsEnabled) {
|
if (Settings.isSessionsEnabled) {
|
||||||
PlayerAuth auth = data.getAuth(name);
|
PlayerAuth auth = data.getAuth(name);
|
||||||
@ -586,6 +591,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
PlayerCache.getInstance().updatePlayer(auth);
|
PlayerCache.getInstance().updatePlayer(auth);
|
||||||
} else {
|
} else {
|
||||||
PlayerCache.getInstance().addPlayer(auth);
|
PlayerCache.getInstance().addPlayer(auth);
|
||||||
|
data.setLogged(name);
|
||||||
}
|
}
|
||||||
m._(player, "valid_session");
|
m._(player, "valid_session");
|
||||||
// Restore Permission Group
|
// Restore Permission Group
|
||||||
@ -606,6 +612,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
//Player change his IP between 2 relog-in
|
//Player change his IP between 2 relog-in
|
||||||
PlayerCache.getInstance().removePlayer(name);
|
PlayerCache.getInstance().removePlayer(name);
|
||||||
|
data.setUnlogged(name);
|
||||||
} else {
|
} else {
|
||||||
GameMode gM = gameMode.get(name);
|
GameMode gM = gameMode.get(name);
|
||||||
this.causeByAuthMe = true;
|
this.causeByAuthMe = true;
|
||||||
@ -617,6 +624,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
} else {
|
} else {
|
||||||
//Session is ended correctly
|
//Session is ended correctly
|
||||||
PlayerCache.getInstance().removePlayer(name);
|
PlayerCache.getInstance().removePlayer(name);
|
||||||
|
data.setUnlogged(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// isent in session or session was ended correctly
|
// isent in session or session was ended correctly
|
||||||
@ -742,6 +750,12 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String ip = player.getAddress().getAddress().getHostAddress();
|
||||||
|
if (Settings.bungee) {
|
||||||
|
if (plugin.realIp.containsKey(name))
|
||||||
|
ip = plugin.realIp.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
if (PlayerCache.getInstance().isAuthenticated(name) && !player.isDead()) {
|
if (PlayerCache.getInstance().isAuthenticated(name) && !player.isDead()) {
|
||||||
if(Settings.isSaveQuitLocationEnabled && data.isAuthAvailable(name)) {
|
if(Settings.isSaveQuitLocationEnabled && data.isAuthAvailable(name)) {
|
||||||
final PlayerAuth auth = new PlayerAuth(name,loc.getX(),loc.getY(),loc.getZ(),loc.getWorld().getName());
|
final PlayerAuth auth = new PlayerAuth(name,loc.getX(),loc.getY(),loc.getZ(),loc.getWorld().getName());
|
||||||
@ -749,8 +763,10 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
data.updateQuitLoc(auth);
|
data.updateQuitLoc(auth);
|
||||||
} catch (NullPointerException npe) { }
|
} catch (NullPointerException npe) { }
|
||||||
}
|
}
|
||||||
|
PlayerAuth auth = new PlayerAuth(name, ip, System.currentTimeMillis());
|
||||||
|
data.updateSession(auth);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.getAuth(name) != null && !PlayerCache.getInstance().isAuthenticated(name) && Settings.enableProtection)
|
if (data.getAuth(name) != null && !PlayerCache.getInstance().isAuthenticated(name) && Settings.enableProtection)
|
||||||
event.setQuitMessage(null);
|
event.setQuitMessage(null);
|
||||||
|
|
||||||
@ -777,9 +793,8 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayerCache.getInstance().removePlayer(name);
|
PlayerCache.getInstance().removePlayer(name);
|
||||||
|
data.setUnlogged(name);
|
||||||
try {
|
try {
|
||||||
PlayersLogs.players.remove(player.getName());
|
|
||||||
PlayersLogs.getInstance().save();
|
|
||||||
player.getVehicle().eject();
|
player.getVehicle().eject();
|
||||||
} catch (NullPointerException ex) {
|
} catch (NullPointerException ex) {
|
||||||
}
|
}
|
||||||
@ -810,12 +825,21 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String name = player.getName().toLowerCase();
|
String name = player.getName().toLowerCase();
|
||||||
if ((PlayerCache.getInstance().isAuthenticated(name)) && (!player.isDead()) &&
|
|
||||||
(Settings.isSaveQuitLocationEnabled) && data.isAuthAvailable(name)) {
|
String ip = player.getAddress().getAddress().getHostAddress();
|
||||||
final PlayerAuth auth = new PlayerAuth(name, loc.getX(), loc.getY(), loc.getZ(),loc.getWorld().getName());
|
if (Settings.bungee) {
|
||||||
try {
|
if (plugin.realIp.containsKey(name))
|
||||||
data.updateQuitLoc(auth);
|
ip = plugin.realIp.get(name);
|
||||||
} catch (NullPointerException npe) { }
|
}
|
||||||
|
if ((PlayerCache.getInstance().isAuthenticated(name)) && (!player.isDead())) {
|
||||||
|
if ((Settings.isSaveQuitLocationEnabled) && data.isAuthAvailable(name)){
|
||||||
|
final PlayerAuth auth = new PlayerAuth(name, loc.getX(), loc.getY(), loc.getZ(),loc.getWorld().getName());
|
||||||
|
try {
|
||||||
|
data.updateQuitLoc(auth);
|
||||||
|
} catch (NullPointerException npe) { }
|
||||||
|
}
|
||||||
|
PlayerAuth auth = new PlayerAuth(name, ip, System.currentTimeMillis());
|
||||||
|
data.updateSession(auth);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.getAuth(name) != null && !PlayerCache.getInstance().isAuthenticated(name) && Settings.enableProtection)
|
if (data.getAuth(name) != null && !PlayerCache.getInstance().isAuthenticated(name) && Settings.enableProtection)
|
||||||
@ -823,50 +847,49 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
|
|
||||||
if (LimboCache.getInstance().hasLimboPlayer(name))
|
if (LimboCache.getInstance().hasLimboPlayer(name))
|
||||||
{
|
{
|
||||||
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name);
|
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name);
|
||||||
if (Settings.protectInventoryBeforeLogInEnabled) {
|
if (Settings.protectInventoryBeforeLogInEnabled) {
|
||||||
try {
|
try {
|
||||||
RestoreInventoryEvent ev = new RestoreInventoryEvent(player, limbo.getInventory(), limbo.getArmour());
|
RestoreInventoryEvent ev = new RestoreInventoryEvent(player, limbo.getInventory(), limbo.getArmour());
|
||||||
plugin.getServer().getPluginManager().callEvent(ev);
|
plugin.getServer().getPluginManager().callEvent(ev);
|
||||||
if (!ev.isCancelled()) {
|
if (!ev.isCancelled()) {
|
||||||
API.setPlayerInventory(player, ev.getInventory(), ev.getArmor());
|
API.setPlayerInventory(player, ev.getInventory(), ev.getArmor());
|
||||||
}
|
}
|
||||||
} catch (NullPointerException npe){
|
} catch (NullPointerException npe){
|
||||||
ConsoleLogger.showError("Problem while restore " + name + " inventory after a kick");
|
ConsoleLogger.showError("Problem while restore " + name + " inventory after a kick");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, limbo.getLoc());
|
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, limbo.getLoc());
|
||||||
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
||||||
if(!tpEvent.isCancelled()) {
|
if(!tpEvent.isCancelled()) {
|
||||||
if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) {
|
if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) {
|
||||||
tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load();
|
tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load();
|
||||||
}
|
}
|
||||||
player.teleport(tpEvent.getTo());
|
player.teleport(tpEvent.getTo());
|
||||||
}
|
}
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException npe) {
|
||||||
}
|
}
|
||||||
this.utils.addNormal(player, limbo.getGroup());
|
this.utils.addNormal(player, limbo.getGroup());
|
||||||
player.setOp(limbo.getOperator());
|
player.setOp(limbo.getOperator());
|
||||||
if (player.getGameMode() != GameMode.CREATIVE && !Settings.isMovementAllowed) {
|
if (player.getGameMode() != GameMode.CREATIVE && !Settings.isMovementAllowed) {
|
||||||
player.setAllowFlight(limbo.isFlying());
|
player.setAllowFlight(limbo.isFlying());
|
||||||
player.setFlying(limbo.isFlying());
|
player.setFlying(limbo.isFlying());
|
||||||
}
|
}
|
||||||
this.plugin.getServer().getScheduler().cancelTask(limbo.getTimeoutTaskId());
|
this.plugin.getServer().getScheduler().cancelTask(limbo.getTimeoutTaskId());
|
||||||
this.plugin.getServer().getScheduler().cancelTask(limbo.getMessageTaskId());
|
this.plugin.getServer().getScheduler().cancelTask(limbo.getMessageTaskId());
|
||||||
LimboCache.getInstance().deleteLimboPlayer(name);
|
LimboCache.getInstance().deleteLimboPlayer(name);
|
||||||
if (this.playerBackup.doesCacheExist(name)) {
|
if (this.playerBackup.doesCacheExist(name)) {
|
||||||
this.playerBackup.removeCache(name);
|
this.playerBackup.removeCache(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
PlayerCache.getInstance().removePlayer(name);
|
||||||
PlayerCache.getInstance().removePlayer(name);
|
data.setUnlogged(name);
|
||||||
PlayersLogs.players.remove(player.getName());
|
if (gameMode.containsKey(name)) gameMode.remove(name);
|
||||||
PlayersLogs.getInstance().save();
|
try {
|
||||||
if (gameMode.containsKey(name)) gameMode.remove(name);
|
player.getVehicle().eject();
|
||||||
player.getVehicle().eject();
|
} catch (NullPointerException ex) {}
|
||||||
player.saveData();
|
player.saveData();
|
||||||
} catch (NullPointerException ex) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
@ -1099,7 +1122,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
if (!Settings.isForcedRegistrationEnabled)
|
if (!Settings.isForcedRegistrationEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Location spawn = plugin.getSpawnLocation(name, player.getWorld());
|
Location spawn = plugin.getSpawnLocation(player, player.getWorld());
|
||||||
if(Settings.isSaveQuitLocationEnabled && data.isAuthAvailable(name)) {
|
if(Settings.isSaveQuitLocationEnabled && data.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 {
|
||||||
|
|||||||
@ -61,7 +61,7 @@ public class AsyncronousLogin {
|
|||||||
}
|
}
|
||||||
if (plugin.captcha.containsKey(name) && plugin.captcha.get(name) >= Settings.maxLoginTry) {
|
if (plugin.captcha.containsKey(name) && plugin.captcha.get(name) >= Settings.maxLoginTry) {
|
||||||
plugin.cap.put(name, rdm.nextString());
|
plugin.cap.put(name, rdm.nextString());
|
||||||
for (String s : m._("need_captcha")) {
|
for (String s : m._("usage_captcha")) {
|
||||||
player.sendMessage(s.replace("THE_CAPTCHA", plugin.cap.get(name)).replace("<theCaptcha>", plugin.cap.get(name)));
|
player.sendMessage(s.replace("THE_CAPTCHA", plugin.cap.get(name)).replace("<theCaptcha>", plugin.cap.get(name)));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -99,6 +99,12 @@ public class AsyncronousLogin {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (Settings.getMaxLoginPerIp > 0 && !plugin.authmePermissible(player, "authme.allow2accounts") && !getIP().equalsIgnoreCase("127.0.0.1") && !getIP().equalsIgnoreCase("localhost")) {
|
||||||
|
if (plugin.isLoggedIp(getIP())) {
|
||||||
|
m._(player, "logged_in");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
PlayerAuth pAuth = database.getAuth(name);
|
PlayerAuth pAuth = database.getAuth(name);
|
||||||
if (pAuth == null) {
|
if (pAuth == null) {
|
||||||
m._(player, "user_unknown");
|
m._(player, "user_unknown");
|
||||||
@ -131,8 +137,6 @@ public class AsyncronousLogin {
|
|||||||
PlayerAuth auth = new PlayerAuth(name, hash, getIP(), new Date().getTime(), email, realName);
|
PlayerAuth auth = new PlayerAuth(name, hash, getIP(), new Date().getTime(), email, realName);
|
||||||
database.updateSession(auth);
|
database.updateSession(auth);
|
||||||
|
|
||||||
plugin.pllog.addPlayer(player);
|
|
||||||
|
|
||||||
if (Settings.useCaptcha) {
|
if (Settings.useCaptcha) {
|
||||||
if (plugin.captcha.containsKey(name)) {
|
if (plugin.captcha.containsKey(name)) {
|
||||||
plugin.captcha.remove(name);
|
plugin.captcha.remove(name);
|
||||||
@ -156,6 +160,7 @@ public class AsyncronousLogin {
|
|||||||
|
|
||||||
// makes player isLoggedin via API
|
// makes player isLoggedin via API
|
||||||
PlayerCache.getInstance().addPlayer(auth);
|
PlayerCache.getInstance().addPlayer(auth);
|
||||||
|
database.setLogged(name);
|
||||||
|
|
||||||
// As the scheduling executes the Task most likely after the current task, we schedule it in the end
|
// As the scheduling executes the Task most likely after the current task, we schedule it in the end
|
||||||
// so that we can be sure, and have not to care if it might be processed in other order.
|
// so that we can be sure, and have not to care if it might be processed in other order.
|
||||||
|
|||||||
@ -68,7 +68,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected void teleportToSpawn() {
|
protected void teleportToSpawn() {
|
||||||
Location spawnL = plugin.getSpawnLocation(name, player.getWorld());
|
Location spawnL = plugin.getSpawnLocation(player, player.getWorld());
|
||||||
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnL, true);
|
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnL, true);
|
||||||
pm.callEvent(tpEvent);
|
pm.callEvent(tpEvent);
|
||||||
if (!tpEvent.isCancelled()) {
|
if (!tpEvent.isCancelled()) {
|
||||||
|
|||||||
@ -148,7 +148,10 @@ public class AsyncronousRegister {
|
|||||||
m._(player, "error");
|
m._(player, "error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerCache.getInstance().addPlayer(auth);
|
if (!Settings.forceRegLogin) {
|
||||||
|
PlayerCache.getInstance().addPlayer(auth);
|
||||||
|
database.setLogged(name);
|
||||||
|
}
|
||||||
ProcessSyncronousPasswordRegister syncronous = new ProcessSyncronousPasswordRegister(player, plugin);
|
ProcessSyncronousPasswordRegister syncronous = new ProcessSyncronousPasswordRegister(player, plugin);
|
||||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, syncronous);
|
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, syncronous);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -49,7 +49,7 @@ public class ProcessSyncronousEmailRegister implements Runnable {
|
|||||||
|
|
||||||
if (Settings.isTeleportToSpawnEnabled) {
|
if (Settings.isTeleportToSpawnEnabled) {
|
||||||
World world = player.getWorld();
|
World world = player.getWorld();
|
||||||
Location loca = plugin.getSpawnLocation(name, world);
|
Location loca = plugin.getSpawnLocation(player, world);
|
||||||
RegisterTeleportEvent tpEvent = new RegisterTeleportEvent(player, loca);
|
RegisterTeleportEvent tpEvent = new RegisterTeleportEvent(player, loca);
|
||||||
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
||||||
if(!tpEvent.isCancelled()) {
|
if(!tpEvent.isCancelled()) {
|
||||||
|
|||||||
@ -7,16 +7,20 @@ import org.bukkit.GameMode;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.Utils;
|
import fr.xephi.authme.Utils;
|
||||||
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.RegisterTeleportEvent;
|
||||||
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.TimeoutTask;
|
||||||
|
|
||||||
public class ProcessSyncronousPasswordRegister implements Runnable {
|
public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||||
|
|
||||||
@ -37,6 +41,39 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
|||||||
} catch (Exception e) {}
|
} catch (Exception e) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void forceLogin(Player player) {
|
||||||
|
if (Settings.isTeleportToSpawnEnabled) {
|
||||||
|
Location spawnLoc = plugin.getSpawnLocation(player, player.getWorld());
|
||||||
|
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, spawnLoc);
|
||||||
|
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
||||||
|
if(!tpEvent.isCancelled()) {
|
||||||
|
if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) {
|
||||||
|
tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load();
|
||||||
|
}
|
||||||
|
player.teleport(tpEvent.getTo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (LimboCache.getInstance().hasLimboPlayer(name))
|
||||||
|
LimboCache.getInstance().deleteLimboPlayer(name);
|
||||||
|
LimboCache.getInstance().addLimboPlayer(player);
|
||||||
|
int delay = Settings.getRegistrationTimeout * 20;
|
||||||
|
int interval = Settings.getWarnMessageInterval;
|
||||||
|
BukkitScheduler sched = plugin.getServer().getScheduler();
|
||||||
|
if (delay != 0) {
|
||||||
|
int id = sched.scheduleSyncDelayedTask(plugin, new TimeoutTask(plugin, name), delay);
|
||||||
|
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||||
|
}
|
||||||
|
int msgT = sched.scheduleSyncDelayedTask(plugin, new MessageTask(plugin, name, m._("login_msg"), interval));
|
||||||
|
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT);
|
||||||
|
try {
|
||||||
|
plugin.pllog.removePlayer(name);
|
||||||
|
if (player.isInsideVehicle())
|
||||||
|
player.getVehicle().eject();
|
||||||
|
} catch (NullPointerException npe) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name);
|
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name);
|
||||||
@ -44,7 +81,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
|||||||
player.setGameMode(limbo.getGameMode());
|
player.setGameMode(limbo.getGameMode());
|
||||||
if (Settings.isTeleportToSpawnEnabled) {
|
if (Settings.isTeleportToSpawnEnabled) {
|
||||||
World world = player.getWorld();
|
World world = player.getWorld();
|
||||||
Location loca = plugin.getSpawnLocation(name, world);
|
Location loca = plugin.getSpawnLocation(player, world);
|
||||||
RegisterTeleportEvent tpEvent = new RegisterTeleportEvent(player, loca);
|
RegisterTeleportEvent tpEvent = new RegisterTeleportEvent(player, loca);
|
||||||
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
||||||
if(!tpEvent.isCancelled()) {
|
if(!tpEvent.isCancelled()) {
|
||||||
@ -73,11 +110,29 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
|||||||
Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true));
|
Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true));
|
||||||
player.saveData();
|
player.saveData();
|
||||||
|
|
||||||
|
if (!Settings.noConsoleSpam)
|
||||||
|
ConsoleLogger.info(player.getName() + " registered "+player.getAddress().getAddress().getHostAddress());
|
||||||
|
if(plugin.notifications != null) {
|
||||||
|
plugin.notifications.showNotification(new Notification("[AuthMe] " + player.getName() + " has registered!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kick Player after Registration is enabled, kick the player
|
||||||
|
if (Settings.forceRegKick) {
|
||||||
|
player.kickPlayer(m._("registered")[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Request Login after Registation
|
||||||
|
if (Settings.forceRegLogin) {
|
||||||
|
forceLogin(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Register is finish and player is logged, display welcome message
|
// Register is finish and player is logged, display welcome message
|
||||||
if(Settings.useWelcomeMessage)
|
if(Settings.useWelcomeMessage)
|
||||||
if(Settings.broadcastWelcomeMessage) {
|
if(Settings.broadcastWelcomeMessage) {
|
||||||
for (String s : Settings.welcomeMsg) {
|
for (String s : Settings.welcomeMsg) {
|
||||||
Bukkit.getServer().broadcastMessage(s);
|
Bukkit.getServer().broadcastMessage(plugin.replaceAllInfos(s, player));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (String s : Settings.welcomeMsg) {
|
for (String s : Settings.welcomeMsg) {
|
||||||
@ -87,11 +142,6 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
|||||||
|
|
||||||
// Register is now finish , we can force all commands
|
// Register is now finish , we can force all commands
|
||||||
forceCommands(player);
|
forceCommands(player);
|
||||||
if (!Settings.noConsoleSpam)
|
|
||||||
ConsoleLogger.info(player.getName() + " registered "+player.getAddress().getAddress().getHostAddress());
|
|
||||||
if(plugin.notifications != null) {
|
|
||||||
plugin.notifications.showNotification(new Notification("[AuthMe] " + player.getName() + " has registered!"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,16 @@
|
|||||||
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.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@ -58,8 +64,24 @@ public class CustomConfiguration extends YamlConfiguration{
|
|||||||
public boolean loadRessource(File file) {
|
public boolean loadRessource(File file) {
|
||||||
boolean out = true;
|
boolean out = true;
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
InputStream fis = getClass().getResourceAsStream("/" + file.getName());
|
try {
|
||||||
FileOutputStream fos = null;
|
InputStream fis = getClass().getResourceAsStream("/" + file.getName());
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(fis, Charset.forName("UTF-8").newDecoder()));
|
||||||
|
String str;
|
||||||
|
Writer writer = new BufferedWriter(new OutputStreamWriter(
|
||||||
|
new FileOutputStream(file), Charset.forName("UTF-8").newEncoder()));
|
||||||
|
while ((str = reader.readLine()) != null) {
|
||||||
|
writer.append(str).append("\r\n");
|
||||||
|
}
|
||||||
|
writer.flush();
|
||||||
|
writer.close();
|
||||||
|
reader.close();
|
||||||
|
fis.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE, "Failed to load config from JAR");
|
||||||
|
out = false;
|
||||||
|
}
|
||||||
|
/*FileOutputStream fos = null;
|
||||||
try {
|
try {
|
||||||
fos = new FileOutputStream(file);
|
fos = new FileOutputStream(file);
|
||||||
byte[] buf = new byte[1024];
|
byte[] buf = new byte[1024];
|
||||||
@ -81,7 +103,8 @@ public class CustomConfiguration extends YamlConfiguration{
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,25 +1,28 @@
|
|||||||
package fr.xephi.authme.settings;
|
package fr.xephi.authme.settings;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Xephi59
|
* @author Xephi59
|
||||||
*/
|
*/
|
||||||
public class PlayersLogs extends CustomConfiguration {
|
public class PlayersLogs extends CustomConfiguration {
|
||||||
private static PlayersLogs pllog = null;
|
private static PlayersLogs pllog = null;
|
||||||
public static List<String> players;
|
public List<String> players;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public PlayersLogs() {
|
public PlayersLogs() {
|
||||||
super(new File("./plugins/AuthMe/players.yml"));
|
super(new File("./plugins/AuthMe/players.yml"));
|
||||||
pllog = this;
|
pllog = this;
|
||||||
load();
|
load();
|
||||||
save();
|
save();
|
||||||
players = (List<String>) this.getList("players");
|
players = this.getStringList("players");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
set("players", new ArrayList<String>());
|
||||||
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlayersLogs getInstance() {
|
public static PlayersLogs getInstance() {
|
||||||
@ -28,13 +31,22 @@ public class PlayersLogs extends CustomConfiguration {
|
|||||||
}
|
}
|
||||||
return pllog;
|
return pllog;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPlayer(Player player) {
|
public void addPlayer(String user) {
|
||||||
List<String> players = this.getStringList("players");
|
players = this.getStringList("players");
|
||||||
if (!players.contains(player.getName())) {
|
if (!players.contains(user.toLowerCase())) {
|
||||||
players.add(player.getName());
|
players.add(user.toLowerCase());
|
||||||
this.set("players", players);
|
set("players", players);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removePlayer(String user) {
|
||||||
|
players = this.getStringList("players");
|
||||||
|
if (players.contains(user.toLowerCase())) {
|
||||||
|
players.remove(user.toLowerCase());
|
||||||
|
set("players", players);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,7 +59,7 @@ public final class Settings extends YamlConfiguration {
|
|||||||
disableSocialSpy, useMultiThreading, forceOnlyAfterLogin, useEssentialsMotd,
|
disableSocialSpy, useMultiThreading, forceOnlyAfterLogin, useEssentialsMotd,
|
||||||
usePurge, purgePlayerDat, purgeEssentialsFile, supportOldPassword, purgeLimitedCreative,
|
usePurge, purgePlayerDat, purgeEssentialsFile, supportOldPassword, purgeLimitedCreative,
|
||||||
purgeAntiXray, purgePermissions, enableProtection, enableAntiBot, recallEmail, useWelcomeMessage,
|
purgeAntiXray, purgePermissions, enableProtection, enableAntiBot, recallEmail, useWelcomeMessage,
|
||||||
broadcastWelcomeMessage;
|
broadcastWelcomeMessage, forceRegKick, forceRegLogin;
|
||||||
|
|
||||||
public static String getNickRegex, getUnloggedinGroup, getMySQLHost, getMySQLPort,
|
public static String getNickRegex, getUnloggedinGroup, getMySQLHost, getMySQLPort,
|
||||||
getMySQLUsername, getMySQLPassword, getMySQLDatabase, getMySQLTablename,
|
getMySQLUsername, getMySQLPassword, getMySQLDatabase, getMySQLTablename,
|
||||||
@ -68,12 +68,12 @@ public final class Settings extends YamlConfiguration {
|
|||||||
getcUnrestrictedName, getRegisteredGroup, messagesLanguage, getMySQLlastlocX, getMySQLlastlocY, getMySQLlastlocZ,
|
getcUnrestrictedName, getRegisteredGroup, messagesLanguage, getMySQLlastlocX, getMySQLlastlocY, getMySQLlastlocZ,
|
||||||
rakamakUsers, rakamakUsersIp, getmailAccount, getmailPassword, getmailSMTP, getMySQLColumnId, getmailSenderName,
|
rakamakUsers, rakamakUsersIp, getmailAccount, getmailPassword, getmailSMTP, getMySQLColumnId, getmailSenderName,
|
||||||
getMailSubject, getMailText, getMySQLlastlocWorld, defaultWorld,
|
getMailSubject, getMailText, getMySQLlastlocWorld, defaultWorld,
|
||||||
getPhpbbPrefix, getWordPressPrefix;
|
getPhpbbPrefix, getWordPressPrefix, getMySQLColumnLogged, spawnPriority;
|
||||||
|
|
||||||
public static int getWarnMessageInterval, getSessionTimeout, getRegistrationTimeout, getMaxNickLength,
|
public static int getWarnMessageInterval, getSessionTimeout, getRegistrationTimeout, getMaxNickLength,
|
||||||
getMinNickLength, getPasswordMinLen, getMovementRadius, getmaxRegPerIp, getNonActivatedGroup,
|
getMinNickLength, getPasswordMinLen, getMovementRadius, getmaxRegPerIp, getNonActivatedGroup,
|
||||||
passwordMaxLength, getRecoveryPassLength, getMailPort, maxLoginTry, captchaLength, saltLength, getmaxRegPerEmail,
|
passwordMaxLength, getRecoveryPassLength, getMailPort, maxLoginTry, captchaLength, saltLength, getmaxRegPerEmail,
|
||||||
bCryptLog2Rounds, getPhpbbGroup, antiBotSensibility, antiBotDuration, delayRecall;
|
bCryptLog2Rounds, getPhpbbGroup, antiBotSensibility, antiBotDuration, delayRecall, getMaxLoginPerIp, getMaxJoinPerIp;
|
||||||
|
|
||||||
protected static YamlConfiguration configFile;
|
protected static YamlConfiguration configFile;
|
||||||
|
|
||||||
@ -235,6 +235,12 @@ public void loadConfigOptions() {
|
|||||||
unsafePasswords = (List<String>) configFile.getList("settings.security.unsafePasswords", new ArrayList<String>());
|
unsafePasswords = (List<String>) configFile.getList("settings.security.unsafePasswords", new ArrayList<String>());
|
||||||
countriesBlacklist = (List<String>) configFile.getList("Protection.countriesBlacklist", new ArrayList<String>());
|
countriesBlacklist = (List<String>) configFile.getList("Protection.countriesBlacklist", new ArrayList<String>());
|
||||||
broadcastWelcomeMessage = configFile.getBoolean("settings.broadcastWelcomeMessage", false);
|
broadcastWelcomeMessage = configFile.getBoolean("settings.broadcastWelcomeMessage", false);
|
||||||
|
forceRegKick = configFile.getBoolean("settings.registration.forceKickAfterRegister", false);
|
||||||
|
forceRegLogin = configFile.getBoolean("settings.registration.forceLoginAfterRegister", false);
|
||||||
|
getMySQLColumnLogged = configFile.getString("DataSource.mySQLColumnLogged","isLogged");
|
||||||
|
spawnPriority = configFile.getString("settings.restrictions.spawnPriority", "authme,essentials,multiverse,default");
|
||||||
|
getMaxLoginPerIp = configFile.getInt("settings.restrictions.maxLoginPerIp", 0);
|
||||||
|
getMaxJoinPerIp = configFile.getInt("settings.restrictions.maxJoinPerIp", 0);
|
||||||
|
|
||||||
// Load the welcome message
|
// Load the welcome message
|
||||||
getWelcomeMessage(plugin);
|
getWelcomeMessage(plugin);
|
||||||
@ -386,6 +392,12 @@ public static void reloadConfigOptions(YamlConfiguration newConfig) {
|
|||||||
unsafePasswords = (List<String>) configFile.getList("settings.security.unsafePasswords", new ArrayList<String>());
|
unsafePasswords = (List<String>) configFile.getList("settings.security.unsafePasswords", new ArrayList<String>());
|
||||||
countriesBlacklist = (List<String>) configFile.getList("Protection.countriesBlacklist", new ArrayList<String>());
|
countriesBlacklist = (List<String>) configFile.getList("Protection.countriesBlacklist", new ArrayList<String>());
|
||||||
broadcastWelcomeMessage = configFile.getBoolean("settings.broadcastWelcomeMessage", false);
|
broadcastWelcomeMessage = configFile.getBoolean("settings.broadcastWelcomeMessage", false);
|
||||||
|
forceRegKick = configFile.getBoolean("settings.registration.forceKickAfterRegister", false);
|
||||||
|
forceRegLogin = configFile.getBoolean("settings.registration.forceLoginAfterRegister", false);
|
||||||
|
getMySQLColumnLogged = configFile.getString("DataSource.mySQLColumnLogged","isLogged");
|
||||||
|
spawnPriority = configFile.getString("settings.restrictions.spawnPriority", "authme,essentials,multiverse,default");
|
||||||
|
getMaxLoginPerIp = configFile.getInt("settings.restrictions.maxLoginPerIp", 0);
|
||||||
|
getMaxJoinPerIp = configFile.getInt("settings.restrictions.maxJoinPerIp", 0);
|
||||||
|
|
||||||
// Reload the welcome message
|
// Reload the welcome message
|
||||||
getWelcomeMessage(AuthMe.getInstance());
|
getWelcomeMessage(AuthMe.getInstance());
|
||||||
@ -525,6 +537,18 @@ public void mergeConfig() {
|
|||||||
}
|
}
|
||||||
if(!contains("settings.broadcastWelcomeMessage"))
|
if(!contains("settings.broadcastWelcomeMessage"))
|
||||||
set("settings.broadcastWelcomeMessage", false);
|
set("settings.broadcastWelcomeMessage", false);
|
||||||
|
if(!contains("settings.registration.forceKickAfterRegister"))
|
||||||
|
set("settings.registration.forceKickAfterRegister", false);
|
||||||
|
if(!contains("settings.registration.forceLoginAfterRegister"))
|
||||||
|
set("settings.registration.forceLoginAfterRegister", false);
|
||||||
|
if(!contains("DataSource.mySQLColumnLogged"))
|
||||||
|
set("DataSource.mySQLColumnLogged", "isLogged");
|
||||||
|
if(!contains("settings.restrictions.spawnPriority"))
|
||||||
|
set("settings.restrictions.spawnPriority", "authme,essentials,multiverse,default");
|
||||||
|
if(!contains("settings.restrictions.maxLoginPerIp"))
|
||||||
|
set("settings.restrictions.maxLoginPerIp", 0);
|
||||||
|
if(!contains("settings.restrictions.maxJoinPerIp"))
|
||||||
|
set("settings.restrictions.maxJoinPerIp", 0);
|
||||||
|
|
||||||
plugin.getLogger().warning("Merge new Config Options if needed..");
|
plugin.getLogger().warning("Merge new Config Options if needed..");
|
||||||
plugin.getLogger().warning("Please check your config.yml file!");
|
plugin.getLogger().warning("Please check your config.yml file!");
|
||||||
@ -728,6 +752,7 @@ public void mergeConfig() {
|
|||||||
while((line = br.readLine()) != null) {
|
while((line = br.readLine()) != null) {
|
||||||
welcomeMsg.add(line);
|
welcomeMsg.add(line);
|
||||||
}
|
}
|
||||||
|
br.close();
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import fr.xephi.authme.ConsoleLogger;
|
|||||||
import fr.xephi.authme.api.API;
|
import fr.xephi.authme.api.API;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
|
import fr.xephi.authme.settings.PlayersLogs;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
|
||||||
|
|
||||||
@ -642,4 +643,28 @@ public class FlatFileThread extends Thread implements DataSource {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSourceType getType() {
|
||||||
|
return DataSourceType.FILE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLogged(String user) {
|
||||||
|
return PlayersLogs.getInstance().players.contains(user.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLogged(String user) {
|
||||||
|
PlayersLogs.getInstance().addPlayer(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUnlogged(String user) {
|
||||||
|
PlayersLogs.getInstance().removePlayer(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void purgeLogged() {
|
||||||
|
PlayersLogs.getInstance().clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import java.sql.Statement;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;
|
import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
@ -41,6 +40,7 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
private String lastlocWorld;
|
private String lastlocWorld;
|
||||||
private String columnEmail;
|
private String columnEmail;
|
||||||
private String columnID;
|
private String columnID;
|
||||||
|
private String columnLogged;
|
||||||
private List<String> columnOthers;
|
private List<String> columnOthers;
|
||||||
private MiniConnectionPoolManager conPool;
|
private MiniConnectionPoolManager conPool;
|
||||||
|
|
||||||
@ -64,6 +64,7 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
this.columnEmail = Settings.getMySQLColumnEmail;
|
this.columnEmail = Settings.getMySQLColumnEmail;
|
||||||
this.columnOthers = Settings.getMySQLOtherUsernameColumn;
|
this.columnOthers = Settings.getMySQLOtherUsernameColumn;
|
||||||
this.columnID = Settings.getMySQLColumnId;
|
this.columnID = Settings.getMySQLColumnId;
|
||||||
|
this.columnLogged = Settings.getMySQLColumnLogged;
|
||||||
try {
|
try {
|
||||||
this.connect();
|
this.connect();
|
||||||
this.setup();
|
this.setup();
|
||||||
@ -121,13 +122,14 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
+ columnID + " INTEGER AUTO_INCREMENT,"
|
+ columnID + " INTEGER AUTO_INCREMENT,"
|
||||||
+ columnName + " VARCHAR(255) NOT NULL UNIQUE,"
|
+ columnName + " VARCHAR(255) NOT NULL UNIQUE,"
|
||||||
+ columnPassword + " VARCHAR(255) NOT NULL,"
|
+ columnPassword + " VARCHAR(255) NOT NULL,"
|
||||||
+ columnIp + " VARCHAR(40) NOT NULL,"
|
+ columnIp + " VARCHAR(40) NOT NULL DEFAULT '127.0.0.1',"
|
||||||
+ columnLastLogin + " BIGINT,"
|
+ columnLastLogin + " BIGINT DEFAULT '0',"
|
||||||
+ lastlocX + " DOUBLE NOT NULL DEFAULT '0.0',"
|
+ lastlocX + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocY + " DOUBLE NOT NULL DEFAULT '0.0',"
|
+ lastlocY + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0',"
|
+ lastlocZ + " DOUBLE NOT NULL DEFAULT '0.0',"
|
||||||
+ lastlocWorld + " VARCHAR(255) DEFAULT 'world',"
|
+ lastlocWorld + " VARCHAR(255) DEFAULT 'world',"
|
||||||
+ columnEmail + " VARCHAR(255) DEFAULT 'your@email.com',"
|
+ columnEmail + " VARCHAR(255) DEFAULT 'your@email.com',"
|
||||||
|
+ columnLogged + " SMALLINT NOT NULL DEFAULT '0',"
|
||||||
+ "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));");
|
+ "CONSTRAINT table_const_prim PRIMARY KEY (" + columnID + "));");
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, columnPassword);
|
rs = con.getMetaData().getColumns(null, null, tableName, columnPassword);
|
||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
@ -160,7 +162,12 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
rs.close();
|
rs.close();
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, columnEmail);
|
rs = con.getMetaData().getColumns(null, null, tableName, columnEmail);
|
||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com' AFTER " + lastlocZ +";");
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnEmail + " VARCHAR(255) DEFAULT 'your@email.com' AFTER " + lastlocWorld +";");
|
||||||
|
}
|
||||||
|
rs.close();
|
||||||
|
rs = con.getMetaData().getColumns(null, null, tableName, columnLogged);
|
||||||
|
if (!rs.next()) {
|
||||||
|
st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + columnLogged + " SMALLINT NOT NULL DEFAULT '0' AFTER " + columnEmail +";");
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
rs = con.getMetaData().getColumns(null, null, tableName, lastlocX);
|
||||||
@ -836,4 +843,105 @@ public class MySQLThread extends Thread implements DataSource {
|
|||||||
ConsoleLogger.info("ConnectionPool was unavailable... Reconnected!");
|
ConsoleLogger.info("ConnectionPool was unavailable... Reconnected!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSourceType getType() {
|
||||||
|
return DataSourceType.MYSQL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLogged(String user) {
|
||||||
|
Connection con = null;
|
||||||
|
PreparedStatement pst = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
try {
|
||||||
|
con = makeSureConnectionIsReady();
|
||||||
|
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE "
|
||||||
|
+ 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;
|
||||||
|
} catch (TimeoutException 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 = makeSureConnectionIsReady();
|
||||||
|
pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE " + columnName + "=?;");
|
||||||
|
pst.setInt(1, 1);
|
||||||
|
pst.setString(2, user);
|
||||||
|
pst.executeUpdate();
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
|
return;
|
||||||
|
} catch (TimeoutException ex) {
|
||||||
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
|
return;
|
||||||
|
} finally {
|
||||||
|
close(pst);
|
||||||
|
close(con);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUnlogged(String user) {
|
||||||
|
Connection con = null;
|
||||||
|
PreparedStatement pst = null;
|
||||||
|
try {
|
||||||
|
con = makeSureConnectionIsReady();
|
||||||
|
pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnLogged + "=? WHERE " + columnName + "=?;");
|
||||||
|
pst.setInt(1, 0);
|
||||||
|
pst.setString(2, user);
|
||||||
|
pst.executeUpdate();
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
|
return;
|
||||||
|
} catch (TimeoutException ex) {
|
||||||
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
|
return;
|
||||||
|
} finally {
|
||||||
|
close(pst);
|
||||||
|
close(con);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void purgeLogged() {
|
||||||
|
Connection con = null;
|
||||||
|
PreparedStatement pst = null;
|
||||||
|
try {
|
||||||
|
con = makeSureConnectionIsReady();
|
||||||
|
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());
|
||||||
|
return;
|
||||||
|
} catch (TimeoutException ex) {
|
||||||
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
|
return;
|
||||||
|
} finally {
|
||||||
|
close(pst);
|
||||||
|
close(con);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import fr.xephi.authme.api.API;
|
|||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.datasource.MiniConnectionPoolManager.TimeoutException;
|
import fr.xephi.authme.datasource.MiniConnectionPoolManager.TimeoutException;
|
||||||
|
import fr.xephi.authme.settings.PlayersLogs;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
|
||||||
|
|
||||||
@ -521,4 +522,28 @@ public class SQLiteThread extends Thread implements DataSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSourceType getType() {
|
||||||
|
return DataSourceType.SQLITE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLogged(String user) {
|
||||||
|
return PlayersLogs.getInstance().players.contains(user.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLogged(String user) {
|
||||||
|
PlayersLogs.getInstance().addPlayer(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUnlogged(String user) {
|
||||||
|
PlayersLogs.getInstance().removePlayer(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void purgeLogged() {
|
||||||
|
PlayersLogs.getInstance().clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@ DataSource:
|
|||||||
mySQLColumnPassword: password
|
mySQLColumnPassword: password
|
||||||
# Password about Database Connection Infos
|
# Password about Database Connection Infos
|
||||||
mySQLPassword: '12345'
|
mySQLPassword: '12345'
|
||||||
# Do we need to cache all things ? Not Recommanded with multiThreading enable
|
# Do we need to cache all query?
|
||||||
caching: true
|
caching: true
|
||||||
# Column for SaveQuitLocation - X
|
# Column for SaveQuitLocation - X
|
||||||
mySQLlastlocX: x
|
mySQLlastlocX: x
|
||||||
@ -35,6 +35,8 @@ DataSource:
|
|||||||
mySQLColumnEmail: email
|
mySQLColumnEmail: email
|
||||||
# Column of IDs to sort data
|
# Column of IDs to sort data
|
||||||
mySQLColumnId: id
|
mySQLColumnId: id
|
||||||
|
# Column for Saving if a player is logged in or not
|
||||||
|
mySQLColumnLogged: isLogged
|
||||||
GroupOptions:
|
GroupOptions:
|
||||||
# if you want to set up a particulary Permission Group for
|
# if you want to set up a particulary Permission Group for
|
||||||
# users that arent registered yet. Pay attention this option
|
# users that arent registered yet. Pay attention this option
|
||||||
@ -154,6 +156,12 @@ settings:
|
|||||||
- world_the_end
|
- world_the_end
|
||||||
# Ban ip when the ip is not the ip registered in database
|
# Ban ip when the ip is not the ip registered in database
|
||||||
banUnsafedIP: false
|
banUnsafedIP: false
|
||||||
|
# Spawn Priority, Values : authme, essentials, multiverse, default
|
||||||
|
spawnPriority: authme,essentials,multiverse,default
|
||||||
|
# Maximum Login authorized by IP
|
||||||
|
maxLoginPerIp: 0
|
||||||
|
# Maximum Join authorized by IP
|
||||||
|
maxJoinPerIp: 0
|
||||||
GameMode:
|
GameMode:
|
||||||
# ForceSurvivalMode to player when join ?
|
# ForceSurvivalMode to player when join ?
|
||||||
ForceSurvivalMode: false
|
ForceSurvivalMode: false
|
||||||
@ -199,10 +207,10 @@ settings:
|
|||||||
# AuthMe will update the password to the new passwordHash !
|
# AuthMe will update the password to the new passwordHash !
|
||||||
supportOldPasswordHash: false
|
supportOldPasswordHash: false
|
||||||
# Cancel unsafe passwords for being used, put them on lowercase!
|
# Cancel unsafe passwords for being used, put them on lowercase!
|
||||||
unsafePasswords: []
|
|
||||||
#unsafePasswords:
|
#unsafePasswords:
|
||||||
#- '123456'
|
#- '123456'
|
||||||
#- 'password'
|
#- 'password'
|
||||||
|
unsafePasswords: []
|
||||||
registration:
|
registration:
|
||||||
# enable registration on the server?
|
# enable registration on the server?
|
||||||
enabled: true
|
enabled: true
|
||||||
@ -218,6 +226,11 @@ settings:
|
|||||||
# when it's true, registration require that kind of command:
|
# when it's true, registration require that kind of command:
|
||||||
# /register <email> <confirmEmail>
|
# /register <email> <confirmEmail>
|
||||||
doubleEmailCheck: false
|
doubleEmailCheck: false
|
||||||
|
# Do we force kicking player after a successful registration ?
|
||||||
|
# Do not use with login feature below
|
||||||
|
forceKickAfterRegister: false
|
||||||
|
# Does AuthMe need to enforce a /login after a successful registration ?
|
||||||
|
forceLoginAfterRegister: false
|
||||||
unrestrictions:
|
unrestrictions:
|
||||||
# below you can list all your account name, that
|
# below you can list all your account name, that
|
||||||
# AuthMe will ignore for registration or login, configure it
|
# AuthMe will ignore for registration or login, configure it
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
unknown_user: '&fKäyttäjä ei ole tietokannassa!'
|
unknown_user: '&fKäyttäjä ei ole tietokannassa!'
|
||||||
unsafe_spawn: '&fHengenvaarallinen poistumispaikka! Siirsimme sinut spawnille!'
|
unsafe_spawn: '&fHengenvaarallinen poistumispaikka! Siirsimme sinut spawnille!'
|
||||||
not_logged_in: '&cEt ole kirjautunut sisään!'
|
not_logged_in: '&cEt ole kirjautunut sisään!'
|
||||||
reg_voluntarily: '&fNyt voit rekisteröidä pelaajasi palvelimellemme: "/register salasana salasana"'
|
reg_voluntarily: '&fNyt voit rekisteröidä pelaajasi palvelimellemme: "/register salasana salasana"'
|
||||||
|
|||||||
@ -1,36 +1,36 @@
|
|||||||
reg_only: Csak regisztrált játékosoknak! Jelentkezni a yndicraft@freemail.hu e-mail címen lehet
|
reg_only: Csak regisztrált játékosoknak! Jelentkezni a yndicraft@freemail.hu e-mail címen lehet
|
||||||
usage_unreg: '&cHasználat: /unregister jelszó'
|
usage_unreg: '&cHasználat: /unregister jelszó'
|
||||||
registered: '&aSikeres regisztráció. Üdvözöllek!'
|
registered: '&aSikeres regisztráció. Üdvözöllek!'
|
||||||
user_regged: '&cJátékosnév már regisztrálva'
|
user_regged: '&cJátékosnév már regisztrálva'
|
||||||
login_msg: '&cKérlek jelentkezz be: "/login jelszó"'
|
login_msg: '&cKérlek jelentkezz be: "/login jelszó"'
|
||||||
not_logged_in: '&cNem vagy bejelentkezve!'
|
not_logged_in: '&cNem vagy bejelentkezve!'
|
||||||
logout: '&cSikeresen kijelentkeztél'
|
logout: '&cSikeresen kijelentkeztél'
|
||||||
usage_log: '&cBejelentkezés: /login jelszó'
|
usage_log: '&cBejelentkezés: /login jelszó'
|
||||||
unknown_user: User is not in database
|
unknown_user: User is not in database
|
||||||
reg_voluntarily: Regisztrálhatod beceneved a szerveren a következö parancsal "/register jelszó jelszó"
|
reg_voluntarily: Regisztrálhatod beceneved a szerveren a következö parancsal "/register jelszó jelszó"
|
||||||
reg_disabled: '&cRegisztráció letiltva'
|
reg_disabled: '&cRegisztráció letiltva'
|
||||||
no_perm: '&cNincs engedélyed'
|
no_perm: '&cNincs engedélyed'
|
||||||
usage_reg: '&cHasználat: /register jelszó jelszóújra'
|
usage_reg: '&cHasználat: /register jelszó jelszóújra'
|
||||||
unregistered: '&cRegisztráció sikeresen törölve!'
|
unregistered: '&cRegisztráció sikeresen törölve!'
|
||||||
same_nick: Ezen a játékosnéven már játszanak
|
same_nick: Ezen a játékosnéven már játszanak
|
||||||
valid_session: '&cSession login'
|
valid_session: '&cSession login'
|
||||||
pwd_changed: '&cJelszó cserélve!'
|
pwd_changed: '&cJelszó cserélve!'
|
||||||
reload: Beálítások és adatbázis újratöltve!
|
reload: Beálítások és adatbázis újratöltve!
|
||||||
timeout: Bejelentkezési idötúllépés
|
timeout: Bejelentkezési idötúllépés
|
||||||
error: Hiba lépett fel; Lépj kapcsolatba a tulajjal'
|
error: Hiba lépett fel; Lépj kapcsolatba a tulajjal'
|
||||||
logged_in: '&cMár be vagy jelentkezve!'
|
logged_in: '&cMár be vagy jelentkezve!'
|
||||||
login: '&aSikeresen Beléptél! Üdvözöllek!!!'
|
login: '&aSikeresen Beléptél! Üdvözöllek!!!'
|
||||||
wrong_pwd: '&4Hibás jelszó'
|
wrong_pwd: '&4Hibás jelszó'
|
||||||
user_unknown: '&cJátékosnév nem regisztrált'
|
user_unknown: '&cJátékosnév nem regisztrált'
|
||||||
reg_msg: '&cKérlek Regisztrálj: "/register jelszó jelszóújra"'
|
reg_msg: '&cKérlek Regisztrálj: "/register jelszó jelszóújra"'
|
||||||
reg_email_msg: '&cPlease register with "/register <email> <confirmEmail>"'
|
reg_email_msg: '&cPlease register with "/register <email> <confirmEmail>"'
|
||||||
unsafe_spawn: A kilépési helyzeted nem biztonságos, teleportálás a kezdö Spawnra.
|
unsafe_spawn: A kilépési helyzeted nem biztonságos, teleportálás a kezdö Spawnra.
|
||||||
max_reg: Csak egy karakterrel Registrálhatsz!!!
|
max_reg: Csak egy karakterrel Registrálhatsz!!!
|
||||||
password_error: A jelszó nem illik össze
|
password_error: A jelszó nem illik össze
|
||||||
unvalid_session: Session Dataes doesnt corrispond Plaese wait the end of session
|
unvalid_session: Session Dataes doesnt corrispond Plaese wait the end of session
|
||||||
pass_len: A jelszavad nem éri el a minimális hosszat
|
pass_len: A jelszavad nem éri el a minimális hosszat
|
||||||
vb_nonActiv: Your Account isent Activated yet check your Emails!
|
vb_nonActiv: Your Account isent Activated yet check your Emails!
|
||||||
usage_changepassword: 'használat: /changepassword régiJelszó újJelszó'
|
usage_changepassword: 'használat: /changepassword régiJelszó újJelszó'
|
||||||
name_len: '&cYour nickname is too Short or too long'
|
name_len: '&cYour nickname is too Short or too long'
|
||||||
regex: '&cYour nickname contains illegal characters. Allowed chars: REG_EX'
|
regex: '&cYour nickname contains illegal characters. Allowed chars: REG_EX'
|
||||||
add_email: '&cPlease add your email with : /email add yourEmail confirmEmail'
|
add_email: '&cPlease add your email with : /email add yourEmail confirmEmail'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
unknown_user: 사용자는 데이터베이스에 없습니다
|
unknown_user: 사용자는 데이터베이스에 없습니다
|
||||||
unsafe_spawn: 당신이 나갔던 위치는 안전하지 않았습니다, 당신을 윌드 스폰으로 텔레포트시킵니다
|
unsafe_spawn: 당신이 나갔던 위치는 안전하지 않았습니다, 당신을 윌드 스폰으로 텔레포트시킵니다
|
||||||
not_logged_in: '&c로그인하지 않았습니다!'
|
not_logged_in: '&c로그인하지 않았습니다!'
|
||||||
reg_voluntarily: 당신이 서버에 게정을 등록하고 싶다면 "/register 비밀번호 비밀번호재입력"을 치세요
|
reg_voluntarily: 당신이 서버에 게정을 등록하고 싶다면 "/register 비밀번호 비밀번호재입력"을 치세요
|
||||||
|
|||||||
@ -3,7 +3,7 @@ author: Xephi59
|
|||||||
website: http://dev.bukkit.org/bukkit-plugins/authme-reloaded/
|
website: http://dev.bukkit.org/bukkit-plugins/authme-reloaded/
|
||||||
description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the current player.
|
description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the current player.
|
||||||
main: fr.xephi.authme.AuthMe
|
main: fr.xephi.authme.AuthMe
|
||||||
version: 3.3.3
|
version: 3.3.4
|
||||||
softdepend: [Vault, ChestShop, Spout, Multiverse-Core, Notifications, Citizens, CombatTag, Essentials, EssentialsSpawn]
|
softdepend: [Vault, ChestShop, Spout, Multiverse-Core, Notifications, Citizens, CombatTag, Essentials, EssentialsSpawn]
|
||||||
commands:
|
commands:
|
||||||
register:
|
register:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user