Merge branch 'Maxetto-master'

This commit is contained in:
Gabriele C 2015-07-10 22:29:04 +02:00
commit 370d37de97
14 changed files with 322 additions and 165 deletions

View File

@ -77,7 +77,7 @@ AuthMe Reloaded prevents players who aren't logged in from actions like placing
</li><li>Possible to use without a Permissions plugin
</li><li><strong>Spoutcraft Login GUI</strong>
</li><li>Automatic backup system of all your user password data
</li><li>Default Language Style: en, de, br, cz, pl, fr, it, ru, hu, sk, es, zhtw, fi, zhcn, nl ( feel free to send new translations )
</li><li>Default Language Style: en, de, br, cz, pl, fr, uk, ru, hu, sk, es, fi, zhtw, zhhk, zhcn, lt, it, ko, pt, nl, gl, bg, eu, tr ( feel free to send new translations )
</li><li>Convert the FlatFile auths.db to an usefull authme.sql that you can use on a MySQL database !
</li><li>Import your database from Rakamak, xAuth, CrazyLogin, RoyalAuth, vAuth !
</li></ul>

View File

@ -149,7 +149,7 @@ public class API {
if (isRegistered(name)) {
return false;
}
PlayerAuth auth = new PlayerAuth(name, hash, "198.18.0.1", 0, "your@email.com");
PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0, "your@email.com");
if (!plugin.database.saveAuth(auth)) {
return false;
}

View File

@ -7,7 +7,7 @@ public class PlayerAuth {
private String nickname = "";
private String hash = "";
private String ip = "198.18.0.1";
private String ip = "192.168.0.1";
private long lastLogin = 0;
private double x = 0;
private double y = 0;

View File

@ -54,21 +54,27 @@ public class AdminCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command cmnd, String label,
String[] args) {
if (args.length == 0) {
sender.sendMessage("Usage: /authme reload - Reload the config");
sender.sendMessage("Usage:");
sender.sendMessage("/authme reload - Reload the config");
sender.sendMessage("/authme version - Get AuthMe version info");
sender.sendMessage("/authme register <playername> <password> - Register a player");
sender.sendMessage("/authme changepassword <playername> <password> - Change player password");
sender.sendMessage("/authme unregister <playername> - Unregister a player");
sender.sendMessage("/authme purge <days> - Purge Database");
sender.sendMessage("/authme version - Get AuthMe version infos");
sender.sendMessage("/authme lastlogin <playername> - Display Date about the Player's LastLogin");
sender.sendMessage("/authme changepassword <playername> <password> - Change a player's password");
sender.sendMessage("/authme chgemail <playername> <email> - Change a player's email");
sender.sendMessage("/authme getemail <playername> - Get a player's email");
sender.sendMessage("/authme getip <onlineplayername> - Display a player's IP if he's online");
sender.sendMessage("/authme lastlogin <playername> - Display the date of a player's last login");
sender.sendMessage("/authme accounts <playername> - Display all player's accounts");
sender.sendMessage("/authme setSpawn - Set AuthMe spawn to your current pos");
sender.sendMessage("/authme spawn - Teleport you to the AuthMe SpawnPoint");
sender.sendMessage("/authme chgemail <playername> <email> - Change player email");
sender.sendMessage("/authme getemail <playername> - Get player email");
sender.sendMessage("/authme purgelastpos <playername> - Purge last position for a player");
sender.sendMessage("/authme switchantibot on/off - Enable/Disable antibot method");
sender.sendMessage("/authme forcelogin <playername>");
sender.sendMessage("/authme purge <days> - Purge database");
sender.sendMessage("/authme purgebannedplayers - Purge database from banned players");
sender.sendMessage("/authme purgelastpos <playername> - Purge last position infos for a player");
sender.sendMessage("/authme setspawn - Set player's spawn to your current position");
sender.sendMessage("/authme setfirstspawn - Set player's first spawn to your current position");
sender.sendMessage("/authme spawn - Teleport yourself to the spawn point");
sender.sendMessage("/authme firstspawn - Teleport yourself to the first spawn point");
sender.sendMessage("/authme switchantibot on/off - Enable/Disable AntiBot feature");
sender.sendMessage("/authme forcelogin <playername> - Enforce the login of a connected player");
sender.sendMessage("/authme passpartutoken - Generate a timed token to login with every player's account (CONSOLE ONLY)");
return true;
}
@ -77,15 +83,15 @@ public class AdminCommand implements CommandExecutor {
return true;
}
if ((sender instanceof ConsoleCommandSender) && args[0].equalsIgnoreCase("passpartuToken")) {
if ((sender instanceof ConsoleCommandSender) && args[0].equalsIgnoreCase("passpartutoken")) {
if (args.length > 1) {
System.out.println("[AuthMe] command usage: /authme passpartuToken");
System.out.println("[AuthMe] command usage: /authme passpartutoken");
return true;
}
if (Utils.getInstance().obtainToken()) {
System.out.println("[AuthMe] You have 30s for insert this token ingame with /passpartu [token]");
System.out.println("[AuthMe] You have 30s to insert this token ingame with /passpartu <token>");
} else {
System.out.println("[AuthMe] Security error on passpartu token, redo it. ");
System.out.println("[AuthMe] Security error on passpartu token, please redo the command.");
}
return true;
}
@ -97,7 +103,11 @@ public class AdminCommand implements CommandExecutor {
if (args[0].equalsIgnoreCase("purge")) {
if (args.length != 2) {
sender.sendMessage("Usage: /authme purge <DAYS>");
sender.sendMessage("Usage: /authme purge <days>");
return true;
}
if (Integer.parseInt(args[1]) < 30) {
sender.sendMessage("You can only purge data older than 30 days")
return true;
}
try {
@ -114,9 +124,10 @@ public class AdminCommand implements CommandExecutor {
plugin.dataManager.purgeLimitedCreative(purged);
if (Settings.purgeAntiXray)
plugin.dataManager.purgeAntiXray(purged);
sender.sendMessage("[AuthMe] Database has been purged correctly");
return true;
} catch (NumberFormatException e) {
sender.sendMessage("Usage: /authme purge <DAYS>");
sender.sendMessage("Usage: /authme purge <days>");
return true;
}
} else if (args[0].equalsIgnoreCase("reload")) {
@ -158,24 +169,23 @@ public class AdminCommand implements CommandExecutor {
return true;
}
try {
if (plugin.database.getAuth(args[1].toLowerCase()) != null) {
PlayerAuth player = plugin.database.getAuth(args[1].toLowerCase());
long lastLogin = player.getLastLogin();
Date d = new Date(lastLogin);
final long diff = System.currentTimeMillis() - lastLogin;
final String msg = (int) (diff / 86400000) + " days " + (int) (diff / 3600000 % 24) + " hours " + (int) (diff / 60000 % 60) + " mins " + (int) (diff / 1000 % 60) + " secs.";
String lastIP = player.getIp();
sender.sendMessage("[AuthMe] " + args[1] + " lastlogin : " + d.toString());
sender.sendMessage("[AuthMe] The player : " + player.getNickname() + " is unlogged since " + msg);
sender.sendMessage("[AuthMe] LastPlayer IP : " + lastIP);
} else {
m.send(sender, "unknown_user");
return true;
}
PlayerAuth auth = plugin.database.getAuth(args[1].toLowerCase());
} catch (NullPointerException e) {
m.send(sender, "unknown_user");
return true;
}
if (auth == null) {
m.send(sender, "user_unknown");
return true;
}
long lastLogin = auth.getLastLogin();
Date d = new Date(lastLogin);
final long diff = System.currentTimeMillis() - lastLogin;
final String msg = (int) (diff / 86400000) + " days " + (int) (diff / 3600000 % 24) + " hours " + (int) (diff / 60000 % 60) + " mins " + (int) (diff / 1000 % 60) + " secs.";
String lastIP = auth.getIp();
sender.sendMessage("[AuthMe] " + args[1] + " lastlogin : " + d.toString());
sender.sendMessage("[AuthMe] The player " + auth.getNickname() + " is unlogged since " + msg);
sender.sendMessage("[AuthMe] Last Player's IP: " + lastIP);
} else if (args[0].equalsIgnoreCase("accounts")) {
if (args.length != 2) {
sender.sendMessage("Usage: /authme accounts <playername>");
@ -183,29 +193,30 @@ public class AdminCommand implements CommandExecutor {
return true;
}
if (!args[1].contains(".")) {
final CommandSender fSender = sender;
final String[] arguments = args;
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
PlayerAuth pAuth = null;
PlayerAuth auth = null;
String message = "[AuthMe] ";
try {
pAuth = plugin.database.getAuth(arguments[1].toLowerCase());
auth = plugin.database.getAuth(args[1].toLowerCase());
} catch (NullPointerException npe) {
fSender.sendMessage("[AuthMe] This player is unknown");
return;
m.send(sender, "unknown_user");
return true;
}
if (pAuth != null) {
List<String> accountList = plugin.database.getAllAuthsByName(pAuth);
if (auth == null) {
m.send(sender, "unknown_user");
return true;
}
List<String> accountList = plugin.database.getAllAuthsByName(auth);
if (accountList.isEmpty() || accountList == null) {
fSender.sendMessage("[AuthMe] This player is unknown");
return;
m.send(sender, "user_unknown");
return true;
}
if (accountList.size() == 1) {
fSender.sendMessage("[AuthMe] " + arguments[1] + " is a single account player");
return;
sender.sendMessage("[AuthMe] " + args[1] + " is a single account player");
return true;
}
int i = 0;
for (String account : accountList) {
@ -217,12 +228,8 @@ public class AdminCommand implements CommandExecutor {
message = message + ".";
}
}
fSender.sendMessage("[AuthMe] " + arguments[1] + " has " + String.valueOf(accountList.size()) + " accounts");
fSender.sendMessage(message);
} else {
fSender.sendMessage("[AuthMe] This player is unknown");
return;
}
sender.sendMessage("[AuthMe] " + args[1] + " has " + String.valueOf(accountList.size()) + " accounts");
sender.sendMessage(message);
}
});
return true;
@ -267,9 +274,28 @@ public class AdminCommand implements CommandExecutor {
} else
if (args[0].equalsIgnoreCase("register") || args[0].equalsIgnoreCase("reg")) {
if (args.length != 3) {
sender.sendMessage("Usage: /authme register playername password");
sender.sendMessage("Usage: /authme register <playername> <password>");
return true;
}
String lowpass = args[2].toLowerCase();
if (lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select") || lowpass.contains(";") || lowpass.contains("null") || !lowpass.matches(Settings.getPassRegex)) {
m.send(player, "password_error");
return true;
}
if (lowpass.equalsIgnoreCase(args[1])) {
m.send(player, "password_error_nick");
return true;
}
if (lowpass.length() < Settings.getPasswordMinLen || lowpass.length() > Settings.passwordMaxLength) {
m.send(player, "pass_len");
return true;
}
if (!Settings.unsafePasswords.isEmpty()) {
if (Settings.unsafePasswords.contains(lowpass)) {
m.send(player, "password_error_unsafe");
return true;
}
}
try {
String name = args[1].toLowerCase();
if (plugin.database.isAuthAvailable(name)) {
@ -277,7 +303,7 @@ public class AdminCommand implements CommandExecutor {
return true;
}
String hash = PasswordSecurity.getHash(Settings.getPasswordHash, args[2], name);
PlayerAuth auth = new PlayerAuth(name, hash, "198.18.0.1", 0L, "your@email.com");
PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0L, "your@email.com");
if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null)
auth.setSalt(PasswordSecurity.userSalt.get(name));
else auth.setSalt("");
@ -294,42 +320,49 @@ public class AdminCommand implements CommandExecutor {
return true;
} else if (args[0].equalsIgnoreCase("getemail")) {
if (args.length != 2) {
sender.sendMessage("Usage: /authme getemail playername");
sender.sendMessage("Usage: /authme getemail <playername>");
return true;
}
String playername = args[1].toLowerCase();
PlayerAuth getAuth = plugin.database.getAuth(playername);
if (getAuth == null) {
PlayerAuth auth = plugin.database.getAuth(playername);
if (auth == null) {
m.send(sender, "unknown_user");
return true;
}
sender.sendMessage("[AuthMe] " + args[1] + " email : " + getAuth.getEmail());
sender.sendMessage("[AuthMe] " + args[1] + "'s email: " + getAuth.getEmail());
return true;
} else if (args[0].equalsIgnoreCase("chgemail")) {
if (args.length != 3) {
sender.sendMessage("Usage: /authme chgemail playername email");
sender.sendMessage("Usage: /authme chgemail <playername> <email>");
return true;
}
if (!Settings.isEmailCorrect(args[2])) {
m.send(player, "email_invalid");
return true;
}
String playername = args[1].toLowerCase();
PlayerAuth getAuth = plugin.database.getAuth(playername);
if (getAuth == null) {
PlayerAuth auth = plugin.database.getAuth(playername);
if (auth == null) {
m.send(sender, "unknown_user");
return true;
}
getAuth.setEmail(args[2]);
if (!plugin.database.updateEmail(getAuth)) {
auth.setEmail(args[2]);
if (!plugin.database.updateEmail(auth)) {
m.send(sender, "error");
return true;
}
if (PlayerCache.getInstance().getAuth(playername) != null)
PlayerCache.getInstance().updatePlayer(getAuth);
PlayerCache.getInstance().updatePlayer(auth);
m.send(sender, "email_changed");
return true;
} else if (args[0].equalsIgnoreCase("setspawn")) {
try {
if (sender instanceof Player) {
if (Spawn.getInstance().setSpawn(((Player) sender).getLocation()))
sender.sendMessage("[AuthMe] Correctly define new spawn");
else sender.sendMessage("[AuthMe] SetSpawn fail , please retry");
if (Spawn.getInstance().setSpawn(((Player) sender).getLocation())) {
sender.sendMessage("[AuthMe] Correctly defined new spawn point");
} else {
sender.sendMessage("[AuthMe] SetSpawn has failed, please retry");
}
} else {
sender.sendMessage("[AuthMe] Please use that command in game");
}
@ -341,8 +374,8 @@ public class AdminCommand implements CommandExecutor {
try {
if (sender instanceof Player) {
if (Spawn.getInstance().setFirstSpawn(((Player) sender).getLocation()))
sender.sendMessage("[AuthMe] Correctly define new first spawn");
else sender.sendMessage("[AuthMe] SetFirstSpawn fail , please retry");
sender.sendMessage("[AuthMe] Correctly defined new first spawn point");
else sender.sendMessage("[AuthMe] SetFirstSpawn has failed, please retry");
} else {
sender.sendMessage("[AuthMe] Please use that command in game");
}
@ -364,13 +397,14 @@ public class AdminCommand implements CommandExecutor {
plugin.dataManager.purgeLimitedCreative(bannedPlayers);
if (Settings.purgeAntiXray)
plugin.dataManager.purgeAntiXray(bannedPlayers);
sender.sendMessage("[AuthMe] Database has been purged correctly");
return true;
} else if (args[0].equalsIgnoreCase("spawn")) {
try {
if (sender instanceof Player) {
if (Spawn.getInstance().getSpawn() != null)
((Player) sender).teleport(Spawn.getInstance().getSpawn());
else sender.sendMessage("[AuthMe] Spawn fail , please try to define the spawn");
else sender.sendMessage("[AuthMe] Spawn has failed, please try to define the spawn");
} else {
sender.sendMessage("[AuthMe] Please use that command in game");
}
@ -383,7 +417,7 @@ public class AdminCommand implements CommandExecutor {
if (sender instanceof Player) {
if (Spawn.getInstance().getFirstSpawn() != null)
((Player) sender).teleport(Spawn.getInstance().getFirstSpawn());
else sender.sendMessage("[AuthMe] Spawn fail , please try to define the first spawn");
else sender.sendMessage("[AuthMe] First spawn has failed, please try to define the first spawn");
} else {
sender.sendMessage("[AuthMe] Please use that command in game");
}
@ -391,12 +425,30 @@ public class AdminCommand implements CommandExecutor {
ConsoleLogger.showError(ex.getMessage());
}
return true;
} else
if (args[0].equalsIgnoreCase("changepassword") || args[0].equalsIgnoreCase("cp")) {
} else if (args[0].equalsIgnoreCase("changepassword") || args[0].equalsIgnoreCase("cp")) {
if (args.length != 3) {
sender.sendMessage("Usage: /authme changepassword playername newpassword");
sender.sendMessage("Usage: /authme changepassword <playername> <newpassword>");
return true;
}
String lowpass = args[2].toLowerCase();
if (lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select") || lowpass.contains(";") || lowpass.contains("null") || !lowpass.matches(Settings.getPassRegex)) {
m.send(player, "password_error");
return true;
}
if (lowpass.equalsIgnoreCase(args[1])) {
m.send(player, "password_error_nick");
return true;
}
if (lowpass.length() < Settings.getPasswordMinLen || lowpass.length() > Settings.passwordMaxLength) {
m.send(player, "pass_len");
return true;
}
if (!Settings.unsafePasswords.isEmpty()) {
if (Settings.unsafePasswords.contains(lowpass)) {
m.send(player, "password_error_unsafe");
return true;
}
}
try {
String name = args[1].toLowerCase();
String hash = PasswordSecurity.getHash(Settings.getPasswordHash, args[2], name);
@ -428,7 +480,7 @@ public class AdminCommand implements CommandExecutor {
return true;
} else if (args[0].equalsIgnoreCase("unregister") || args[0].equalsIgnoreCase("unreg") || args[0].equalsIgnoreCase("del")) {
if (args.length != 2) {
sender.sendMessage("Usage: /authme unregister playername");
sender.sendMessage("Usage: /authme unregister <playername>");
return true;
}
String name = args[1].toLowerCase();
@ -474,24 +526,24 @@ public class AdminCommand implements CommandExecutor {
m.send(sender, "unregistered");
ConsoleLogger.info(args[1] + " unregistered");
return true;
} else if (args[0].equalsIgnoreCase("purgelastpos")) {
} else if (args[0].equalsIgnoreCase("purgelastpos") || args[0].equalsIgnoreCase("resetposition")) {
if (args.length != 2) {
sender.sendMessage("Usage: /authme purgelastpos playername");
sender.sendMessage("Usage: /authme purgelastpos <playername>");
return true;
}
try {
String name = args[1].toLowerCase();
PlayerAuth auth = plugin.database.getAuth(name);
if (auth == null) {
sender.sendMessage("The player " + name + " is not registered ");
m.send(sender, "unknown_user");
return true;
}
auth.setQuitLocX(0);
auth.setQuitLocY(0);
auth.setQuitLocZ(0);
auth.setQuitLocX(0D);
auth.setQuitLocY(0D);
auth.setQuitLocZ(0D);
auth.setWorld("world");
plugin.database.updateQuitLoc(auth);
sender.sendMessage(name + " 's last pos location is now reset");
sender.sendMessage(name + "'s last position location is now reset");
} catch (Exception e) {
ConsoleLogger.showError("An error occured while trying to reset location or player do not exist, please see below: ");
ConsoleLogger.showError(e.getMessage());
@ -501,7 +553,7 @@ public class AdminCommand implements CommandExecutor {
return true;
} else if (args[0].equalsIgnoreCase("switchantibot")) {
if (args.length != 2) {
sender.sendMessage("Usage : /authme switchantibot on/off");
sender.sendMessage("Usage: /authme switchantibot on/off");
return true;
}
if (args[1].equalsIgnoreCase("on")) {
@ -514,49 +566,31 @@ public class AdminCommand implements CommandExecutor {
sender.sendMessage("[AuthMe] AntiBotMod disabled");
return true;
}
sender.sendMessage("Usage : /authme switchantibot on/off");
sender.sendMessage("Usage: /authme switchantibot on/off");
return true;
} else if (args[0].equalsIgnoreCase("getip")) {
if (args.length < 2) {
sender.sendMessage("Usage : /authme getip onlinePlayerName");
sender.sendMessage("Usage: /authme getip <onlineplayername>");
return true;
}
if (Bukkit.getPlayer(args[1]) != null) {
Player player = Bukkit.getPlayer(args[1]);
sender.sendMessage(player.getName() + " actual ip is : " + player.getAddress().getAddress().getHostAddress() + ":" + player.getAddress().getPort());
sender.sendMessage(player.getName() + " real ip is : " + plugin.getIP(player));
return true;
} else {
if (player == null) {
sender.sendMessage("This player is not actually online");
sender.sendMessage("Usage : /authme getip onlinePlayerName");
sender.sendMessage("Usage: /authme getip <onlineplayername>");
return true;
}
} else if (args[0].equalsIgnoreCase("resetposition")) {
if (args.length < 2) {
sender.sendMessage("Usage : /authme resetPosition <playerName>");
return true;
}
PlayerAuth auth = plugin.database.getAuth(args[1]);
if (auth == null) {
m.send(sender, "unknown_user");
return true;
}
auth.setQuitLocX(0D);
auth.setQuitLocY(0D);
auth.setQuitLocZ(0D);
auth.setWorld("world");
plugin.database.updateQuitLoc(auth);
sender.sendMessage("[AuthMe] Successfully reset position for " + auth.getNickname());
sender.sendMessage(player.getName() + "'s actual IP is : " + player.getAddress().getAddress().getHostAddress() + ":" + player.getAddress().getPort());
sender.sendMessage(player.getName() + "'s real IP is : " + plugin.getIP(player));
return true;
} else if (args[0].equalsIgnoreCase("forcelogin")) {
if (args.length < 2) {
sender.sendMessage("Usage : /authme forcelogin <playerName>");
sender.sendMessage("Usage: /authme forcelogin <playername>");
return true;
}
try {
Player player = Bukkit.getPlayer(args[1]);
if (player == null || !player.isOnline()) {
sender.sendMessage("Online player only !");
sender.sendMessage("Player needs to be online!");
return true;
}
if (!plugin.authmePermissible(player, "authme.canbeforced")) {
@ -564,7 +598,7 @@ public class AdminCommand implements CommandExecutor {
return true;
}
plugin.management.performLogin(player, "dontneed", true);
sender.sendMessage("Force Login performed !");
sender.sendMessage("Force Login performed!");
} catch (Exception e) {
sender.sendMessage("An error occured while trying to get that player!");
}

View File

@ -49,11 +49,11 @@ public class ChangePasswordCommand implements CommandExecutor {
}
String lowpass = args[1].toLowerCase();
if ((lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select") || lowpass.contains(";") || lowpass.contains("null")) || !lowpass.matches(Settings.getPassRegex)) {
if (lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select") || lowpass.contains(";") || lowpass.contains("null") || !lowpass.matches(Settings.getPassRegex)) {
m.send(player, "password_error");
return true;
}
if ((lowpass.equalsIgnoreCase(name))) {
if (lowpass.equalsIgnoreCase(name)) {
m.send(player, "password_error_nick");
return true;
}

View File

@ -48,7 +48,7 @@ public class xAuthToFlat {
String pl = getIdPlayer(id);
String psw = getPassword(id);
if (psw != null && !psw.isEmpty() && pl != null) {
PlayerAuth auth = new PlayerAuth(pl, psw, "198.18.0.1", 0, "your@email.com");
PlayerAuth auth = new PlayerAuth(pl, psw, "192.168.0.1", 0, "your@email.com");
database.saveAuth(auth);
}
}

View File

@ -427,7 +427,7 @@ public class FlatFile implements DataSource {
if (args[0].equalsIgnoreCase(user)) {
switch (args.length) {
case 2:
return new PlayerAuth(args[0], args[1], "198.18.0.1", 0, "your@email.com");
return new PlayerAuth(args[0], args[1], "192.168.0.1", 0, "your@email.com");
case 3:
return new PlayerAuth(args[0], args[1], args[2], 0, "your@email.com");
case 4:
@ -709,7 +709,7 @@ public class FlatFile implements DataSource {
String[] args = line.split(":");
switch (args.length) {
case 2:
auths.add(new PlayerAuth(args[0], args[1], "198.18.0.1", 0, "your@email.com"));
auths.add(new PlayerAuth(args[0], args[1], "192.168.0.1", 0, "your@email.com"));
case 3:
auths.add(new PlayerAuth(args[0], args[1], args[2], 0, "your@email.com"));
case 4:

View File

@ -204,7 +204,7 @@ public class MySQL implements DataSource {
if (rs.next()) {
id = rs.getInt(columnID);
if (rs.getString(columnIp).isEmpty() && rs.getString(columnIp) != null) {
pAuth = new PlayerAuth(rs.getString(columnName).toLowerCase(), rs.getString(columnPassword), "198.18.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail));
pAuth = new PlayerAuth(rs.getString(columnName).toLowerCase(), rs.getString(columnPassword), "192.168.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail));
} else {
if (!columnSalt.isEmpty()) {
if (!columnGroup.isEmpty())
@ -1079,7 +1079,7 @@ public class MySQL implements DataSource {
PlayerAuth pAuth = null;
int id = rs.getInt(columnID);
if (rs.getString(columnIp).isEmpty() && rs.getString(columnIp) != null) {
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "198.18.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail));
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "192.168.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail));
} else {
if (!columnSalt.isEmpty()) {
if (!columnGroup.isEmpty())

View File

@ -155,7 +155,7 @@ public class SQLite implements DataSource {
rs = pst.executeQuery();
if (rs.next()) {
if (rs.getString(columnIp).isEmpty()) {
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "198.18.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail));
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "192.168.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail));
} else {
if (!columnSalt.isEmpty()) {
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail));

View File

@ -53,16 +53,28 @@ public class AsyncronousRegister {
allowRegister = false;
}
else if ((lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select") || lowpass.contains(";") || lowpass.contains("null")) || !lowpass.matches(Settings.getPassRegex)) {
else if (lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select") || lowpass.contains(";") || lowpass.contains("null") || !lowpass.matches(Settings.getPassRegex)) {
m.send(player, "password_error");
allowRegister = false;
}
else if ((lowpass.equalsIgnoreCase(player.getName()))) {
else if (lowpass.equalsIgnoreCase(player.getName())) {
m.send(player, "password_error_nick");
allowRegister = false;
}
else if (password.length() < Settings.getPasswordMinLen || password.length() > Settings.passwordMaxLength) {
m.send(player, "pass_len");
allowRegister = false;
}
else if (!Settings.unsafePasswords.isEmpty()) {
if (Settings.unsafePasswords.contains(password.toLowerCase())) {
m.send(player, "password_error_unsafe");
allowRegister = false;
}
}
else if (database.isAuthAvailable(name)) {
m.send(player, "user_regged");
PlayersLogs.getInstance().savePlayerLogs();
@ -124,16 +136,6 @@ public class AsyncronousRegister {
}
protected void passwordRegister() {
if (password.length() < Settings.getPasswordMinLen || password.length() > Settings.passwordMaxLength) {
m.send(player, "pass_len");
return;
}
if (!Settings.unsafePasswords.isEmpty()) {
if (Settings.unsafePasswords.contains(password.toLowerCase())) {
m.send(player, "password_error_unsafe");
return;
}
}
PlayerAuth auth = null;
String hash = "";
try {

View File

@ -848,6 +848,8 @@ public final class Settings extends YamlConfiguration {
pt,
nl,
gl,
bg
bg,
eu,
tr
}
}

View File

@ -0,0 +1,59 @@
unknown_user: '&fErabiltzailea ez dago datu basean'
unsafe_spawn: '&fSpawn-era telegarraiatu zara'
not_logged_in: '&cSaioa hasi gabe!'
reg_voluntarily: '&fZure erabiltzailea erregistratu dezakezu:"/register pasahitza pasahitza"'
usage_log: '&cErabili: /login pasahitza'
wrong_pwd: '&cPasahitz okerra'
unregistered: '&cZure erregistroa ezabatu duzu!'
reg_disabled: '&cErregistroa desgaitua'
valid_session: '&cSession login'
login: '&cOngi etorri!'
vb_nonActiv: '&fZure kontua aktibatu gabe dago, konfirmatu zure emaila!'
user_regged: '&cErabiltzailea dagoeneko erregistratua'
usage_reg: '&cErabili: /register pasahitza pasahitza'
max_reg: '&fKontuko 2 erabiltzaile bakarrik izan ditzakezu'
no_perm: '&cBaimenik ez'
error: '&fErrorea; Mesedez jarri kontaktuan administratzaile batekin'
login_msg: '&cMesedez erabili "/login pasahitza" saioa hasteko'
reg_msg: '&cMesedez erabili "/register pasahitza pasahitza" erregistratzeko'
reg_email_msg: '&cMesdez erabili "/register <email> <confirmEmail>" erregistratzeko'
usage_unreg: '&cErabili: /unregister password'
pwd_changed: '&cPasahitza aldatu duzu!'
user_unknown: '&cErabiltzailea ez dago erregistratuta'
password_error: '&fPasahitzak ez datoz bat'
password_error_nick: '&fYou can''t use your name as password, please choose another one'
password_error_unsafe: '&fThe chosen password is not safe, please choose another one'
invalid_session: '&fSession Dataes doesnt corrispond Plaese wait the end of session'
reg_only: '&fErregistratuako erabiltzaileak bakarrik! Mesedez bisitatu http://example.com erregistratzeko'
logged_in: '&cDagoeneko saioa hasita!'
logout: '&cAtera zara'
same_nick: '&fZure izen berdina duen erabiltzaile bat zerbitzarian jolasten dago'
registered: '&cOndo erregistratu zara!'
pass_len: '&fZure pasahitza motzegia edo luzeegia da'
reload: '&fConfiguration and database has been reloaded'
timeout: '&fDenbora gehiegi egon zara saioa hasi gabe'
usage_changepassword: '&fErabili: /changepassword pasahitzZaharra pasahitzBerria'
name_len: '&cZure erabiltzaile izena motzegia edo luzeegia da'
regex: '&cZure erabiltzaileak karaktere debekatuak ditu. Karaktere onartuak: REG_EX'
add_email: '&cMesedez gehitu zure emaila : /email add yourEmail confirmEmail'
bad_database_email: '[AuthMe] /email komandoa MySql-rekin bakarrik dago erabilgarri. Jarri kontaktuan administratzaile batekin'
recovery_email: '&cPasahitza ahaztu duzu? Erabili /email recovery <zureemaila>'
usage_captcha: '&cYou need to type a captcha, please type: /captcha <theCaptcha>'
wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA'
valid_captcha: '&cYour captcha is valid !'
kick_forvip: '&cVIP erabiltzaile bat sartu da zerbitzaria beteta zegoenean!'
kick_fullserver: '&cZerbitzaria beteta dago, Barkatu!'
usage_email_add: '&fErabili: /email add <email> <confirmeEmail> '
usage_email_change: '&fErabili: /email change <emailZaharra> <emailBerria> '
usage_email_recovery: '&fErabili: /email recovery <Email>'
new_email_invalid: '[AuthMe] Email okerra!'
old_email_invalid: '[AuthMe] Email zaharra okerra!'
email_invalid: '[AuthMe] Email okerrea'
email_added: '[AuthMe] Emaila gehitu duzu !'
email_confirm: '[AuthMe] Konfirmatu zure emaila !'
email_changed: '[AuthMe] Emaila aldatua!'
email_send: '[AuthMe] Berreskuratze emaila bidalita !'
email_exists: '[AuthMe] An email already exists on your account. You can change it using the command below'
country_banned: '[AuthMe]Zure herrialdea blokeatuta dago zerbitzari honetan'
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes,hope invasion stopped'

View File

@ -4,13 +4,14 @@ not_logged_in: '&cNon hai ancora eseguito l''autenticazione!'
reg_voluntarily: 'Puoi eseguire la registrazione al server con il comando: "/register <password> <confermaPassword>"'
usage_log: '&cUtilizzo: /login <password>'
wrong_pwd: '&cPassword non corretta!'
unregistered: '&cL''utente è stato rimosso dal database con successo!'
unregistered: '&cSei stato rimosso dal database con successo!'
reg_disabled: '&cLa registrazione tramite i comandi di gioco è disabilitata.'
valid_session: '&cAutenticato automaticamente attraverso la precedente sessione!'
login: '&cAutenticazone effettuata correttamente!'
vb_nonActiv: 'Il tuo account non è stato ancora verificato, controlla fra le tue email per scoprire come attivarlo!'
user_regged: '&cHai già effettuato la registrazione, non è possibile eseguirla nuovamente.'
user_regged: '&cHai già effettuato la registrazione, non puoi eseguirla nuovamente.'
usage_reg: '&cUtilizzo: /register <password> <confermaPassword>'
error: 'Qualcosa è andato storto, riporta questo errore ad un Admin!'
max_reg: 'Hai raggiunto il numero massimo di registrazioni per questo indirizzo IP!'
no_perm: '&cNon hai il permesso di eseguire questa operazione.'
login_msg: '&cPerfavore, esegui l''autenticazione con il comando: "/login <password>"'
@ -23,35 +24,35 @@ password_error: 'Le Password non corrispondono!'
password_error_nick: 'Non puoi usare il tuo nome utente come password, scegline un''altra!'
password_error_unsafe: 'La password che hai inserito non è sicura, scegline un''altra!'
invalid_session: 'I tuoi dati di connessione attuali non sono quelli utilizzati in precedenza. Attendi la fine della sessione attuale.'
reg_only: 'La registrazione è effettuabile soltanto attraverso il sito web! Perfavore, vai su http://example.com per procedere!'
logged_in: '&cHai già eseguito l''autenticazione!'
reg_only: 'Puoi giocare in questo server solo dopo aver effettuato la registrazione attraverso il sito web! Perfavore, vai su http://esempio.it per procedere!'
logged_in: '&cHai già eseguito l''autenticazione, non devi eseguirla nuovamente!'
logout: '&cDisconnessione avvenuta correttamente!'
same_nick: 'Lo stesso nickname è già online sul server!'
same_nick: 'Questo stesso nome utente è già online sul server!'
registered: '&cRegistrato correttamente!'
pass_len: 'La tua password è troppo corta o troppo lunga, scegline un''altra!'
pass_len: 'La password che hai inserito è troppo corta o troppo lunga, scegline un''altra!'
reload: 'La configurazione e il database sono stati ricaricati con successo!'
timeout: 'Tempo scaduto per effettuare l''autenticazione'
usage_changepassword: 'Utilizzo: /changepassword <vecchiaPassword> <nuovaPassword>'
name_len: '&cIl tuo nickname è troppo corto o troppo lungo!'
regex: '&cIl tuo nickname contiene caratteri non consentiti. I caratteri consentiti sono: REG_EX'
add_email: '&cPer poter recuperare la password in futuro, aggiungi una email al tuo account con il comando: "/email add <tuaEmail> <confermaEmail>"'
name_len: '&cIl tuo nome utente è troppo corto o troppo lungo!'
regex: '&cIl tuo nome utente contiene caratteri non consentiti. I caratteri consentiti sono: REG_EX'
add_email: '&cPer poter recuperare la password in futuro, aggiungi un indirizzo email al tuo account con il comando: "/email add <tuaEmail> <confermaEmail>"'
bad_database_email: 'Il comando /email è utilizzabile solo con un database MySQL o SQLite, riporta questo errore ad un Admin!'
recovery_email: '&cHai dimenticato la tua password? Puoi recuperarla eseguendo il comando: "/email recovery <tuaEmail>"'
usage_captcha: '&cUtilizzo: /captcha THE_CAPTCHA'
wrong_captcha: '&cCodice captcha sbagliato, perfavore riprova con il comando: "/captcha THE_CAPTCHA"'
valid_captcha: '&cIl tuo captcha è valido!'
kick_forvip: '&cUn utente VIP è entrato mentre il server era pieno!'
usage_captcha: '&cAbbiamo bisogno che tu inserisca un captcha, perfavore scrivi: "/captcha THE_CAPTCHA"'
wrong_captcha: '&cCaptcha sbagliato, perfavore riprova con il comando: "/captcha THE_CAPTCHA"'
valid_captcha: '&cIl captcha inserito è valido!'
kick_forvip: '&cUn utente VIP è entrato mentre il server era pieno e ha preso il tuo posto!'
kick_fullserver: '&cIl server è attualmente pieno, riprova più tardi!'
usage_email_add: '&fUtilizzo: /email add <email> <confermaEmail>'
usage_email_change: '&fUtilizzo: /email change <vecchiaEmail> <nuovaEmail>'
usage_email_recovery: '&fUtilizzo: /email recovery <email>'
new_email_invalid: 'La nuova email non è valida!'
old_email_invalid: 'La vecchia email non è valida!'
new_email_invalid: 'Il nuovo indirizzo email inserito non è valido!'
old_email_invalid: 'Il vecchio indirizzo email inserito non è valido!'
email_invalid: 'L''indirizzo email inserito non è valido'
email_added: 'Email aggiunta correttamente!'
email_confirm: 'Conferma la tua email!'
email_changed: 'Email cambiata correttamente!'
email_send: 'Email di recupero inviata al tuo indirizzo email!'
email_added: 'Indirizzo email aggiunto correttamente!'
email_confirm: 'Conferma il tuo indirizzo email!'
email_changed: 'Indirizzo email cambiato correttamente!'
email_send: 'Una email di recupero è stata appena inviata al tuo indirizzo email!'
email_exists: 'Il tuo account ha già un''indirizzo email configurato. Se vuoi, puoi cambiarlo con il seguente comando:'
country_banned: 'Il tuo paese è bandito da questo server!'
antibot_auto_enabled: 'Il servizio di AntiBot è stato automaticamente abilitato a seguito delle numerose connessioni!'

View File

@ -0,0 +1,59 @@
unknown_user: '&fKullanici veritabanina ekli degil'
unsafe_spawn: '&fDogdugunuz konum guvenli degildi, lobiye isinlaniyorsunuz...'
not_logged_in: '&cGiris Yapmadin!'
reg_voluntarily: '&fKullanici adinla kayit olabilirsin! Komut: "/register sifren sifrentekrar"'
usage_log: '&cKullanimi: /login sifren'
wrong_pwd: '&cYanlis sifre'
unregistered: '&cSunucudan kaydiniz basariyla silindi!'
reg_disabled: '&cKayit deaktif'
valid_session: '&cOturum Acma'
login: '&cBasarili giris!'
vb_nonActiv: '&fHesabin aktiflestirilmedi! Emailini kontrol et'
user_regged: '&cKullanici zaten oyunda'
usage_reg: '&cKullanimi: /register sifre sifretekrar'
max_reg: '&fMaximim kayit limitini astin!'
no_perm: '&cYetkin yok'
error: '&fBir hata olustu; Lutfen adminle iletisime gec'
login_msg: '&cGiris Yapin : "/login sifre"'
reg_msg: '&cLutfen kaydolmak icin : "/register sifre sifretekrar"'
reg_email_msg: '&cLutfen Kaydolmak icin : "/register <eposta> <eposta tekrar>"'
usage_unreg: '&cKullanimi: /unregister sifren'
pwd_changed: '&cSifreniz degisti!'
user_unknown: '&cBu kullaniciyla kaydolunmamis!'
password_error: '&fSifren eslesmiyor'
password_error_nick: '&fYou can''t use your name as password, please choose another one'
password_error_unsafe: '&fThe chosen password is not safe, please choose another one'
invalid_session: '&fOturum veritabanlari uyusmuyor lutfen sonunu bekleyin'
reg_only: '&fSadece kayitli uyeler girebilir ! Kayit olmak icin www.orneksite.com adresini ziyaret ediniz !'
logged_in: '&cZaten Giris Yapilmis!'
logout: '&cBasarili cikis'
same_nick: '&fAyni kullanici oyunda'
registered: '&cBasarili kayit!'
pass_len: '&fSifren cok uzun ya da kisa olmamali '
reload: '&fKonfigurasyon dosyasi ve veritabani yüklendi'
timeout: '&fZaman Asimi'
usage_changepassword: '&fkullanimi: /changepassword eskisifre yenisifre'
name_len: '&cKullanici adin cok kisa ya da cok uzun'
regex: '&cKullanici adin ozel karakterler iceriyor. Uygun karakterler: REG_EX'
add_email: '&cLutfen emailini ekle : /email add <epostan> <epostantekrar>'
bad_database_email: '[AuthMe] Bu /email komutu sadece MySql ve SQLite ile etkinlestireilebilir'
recovery_email: '&cSifreni mi unuttun? Degistirmek icin : /email recovery <eposta adresin>'
usage_captcha: '&cBir captcha yazman lazim , yazmak icin: /captcha <theCaptcha>'
wrong_captcha: '&cYanlis Captcha, kullanmak icin : /captcha THE_CAPTCHA'
valid_captcha: '&cCaptcha gecerli !'
kick_forvip: '&cSenin yerine bir VIP kullanıcı girdi!'
kick_fullserver: '&cServer suanda dolu gozukuyor, Uzgunum!'
usage_email_add: '&fKullanimi: /email add <eposta> <epostatekrar> '
usage_email_change: '&fKullanimi: /email change <EskiEposta> <YeniEposta> '
usage_email_recovery: '&fKullanimi: /email recovery <Eposta>'
new_email_invalid: '[AuthMe] Yeni eposta gecersiz!'
old_email_invalid: '[AuthMe] Eski eposta gecersiz!'
email_invalid: '[AuthMe] Gecersiz Eposta'
email_added: '[AuthMe] Eposta Eklendi !'
email_confirm: '[AuthMe] Epostani Dogrula !'
email_changed: '[AuthMe] Eposta Degistirildi !'
email_send: '[AuthMe] Kurtarma postasi gonderildi !'
email_exists: '[AuthMe] An email already exists on your account. You can change it using the command below'
country_banned: 'Ulken bu serverdan banlandi !'
antibot_auto_enabled: '[AuthMe] AntiBotMode otomatik olarak etkinlestirildi!'
antibot_auto_disabled: '[AuthMe] AntiBotMode %m dakika sonra otomatik olarak isgal yuzundan devredisi birakildi'