Replace m._ by a method call m.send, Java 8 in comming ...

This commit is contained in:
Xephi 2015-05-26 13:03:45 +02:00
parent 5585db221f
commit 9ba90bfb97
20 changed files with 170 additions and 172 deletions

View File

@ -13,7 +13,6 @@ import java.util.Collection;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Random;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
@ -122,8 +121,7 @@ public class AuthMe extends JavaPlugin {
try { try {
settings = new Settings(this); settings = new Settings(this);
settings.loadConfigOptions(); settings.loadConfigOptions();
} catch (Exception e) } catch (Exception e) {
{
ConsoleLogger.showError("Can't load config file... Something goes wrong, for prevent security issues, server will shutdown"); ConsoleLogger.showError("Can't load config file... Something goes wrong, for prevent security issues, server will shutdown");
this.getServer().shutdown(); this.getServer().shutdown();
return; return;
@ -236,7 +234,7 @@ public class AuthMe extends JavaPlugin {
if (Settings.isCachingEnabled) { if (Settings.isCachingEnabled) {
database = new CacheDataSource(this, database); database = new CacheDataSource(this, database);
if (database instanceof CacheDataSource) if (database instanceof CacheDataSource)
((CacheDataSource)database).start(); ((CacheDataSource) database).start();
} }
dataManager = new DataManager(this, database); dataManager = new DataManager(this, database);
@ -729,7 +727,7 @@ public class AuthMe extends JavaPlugin {
if (PlayerCache.getInstance().isAuthenticated(name)) { if (PlayerCache.getInstance().isAuthenticated(name)) {
String email = database.getAuth(name).getEmail(); String email = database.getAuth(name).getEmail();
if (email == null || email.isEmpty() || email.equalsIgnoreCase("your@email.com")) if (email == null || email.isEmpty() || email.equalsIgnoreCase("your@email.com"))
m._(player, "add_email"); m.send(player, "add_email");
} }
} }
} }

View File

@ -77,7 +77,7 @@ public class AdminCommand implements CommandExecutor {
} }
if (!plugin.authmePermissible(sender, "authme.admin." + args[0].toLowerCase())) { if (!plugin.authmePermissible(sender, "authme.admin." + args[0].toLowerCase())) {
m._(sender, "no_perm"); m.send(sender, "no_perm");
return true; return true;
} }
@ -155,7 +155,7 @@ public class AdminCommand implements CommandExecutor {
Settings.reloadConfigOptions(newConfig); Settings.reloadConfigOptions(newConfig);
m.reLoad(); m.reLoad();
s.reLoad(); s.reLoad();
m._(sender, "reload"); m.send(sender, "reload");
} else if (args[0].equalsIgnoreCase("lastlogin")) { } else if (args[0].equalsIgnoreCase("lastlogin")) {
if (args.length != 2) { if (args.length != 2) {
sender.sendMessage("Usage: /authme lastlogin <playername>"); sender.sendMessage("Usage: /authme lastlogin <playername>");
@ -173,11 +173,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 {
m._(sender, "unknown_user"); m.send(sender, "unknown_user");
return true; return true;
} }
} catch (NullPointerException e) { } catch (NullPointerException e) {
m._(sender, "unknown_user"); m.send(sender, "unknown_user");
return true; return true;
} }
} else if (args[0].equalsIgnoreCase("accounts")) { } else if (args[0].equalsIgnoreCase("accounts")) {
@ -276,7 +276,7 @@ public class AdminCommand implements CommandExecutor {
try { try {
String name = args[1].toLowerCase(); String name = args[1].toLowerCase();
if (database.isAuthAvailable(name)) { if (database.isAuthAvailable(name)) {
m._(sender, "user_regged"); m.send(sender, "user_regged");
return true; return true;
} }
String hash = PasswordSecurity.getHash(Settings.getPasswordHash, args[2], name); String hash = PasswordSecurity.getHash(Settings.getPasswordHash, args[2], name);
@ -285,14 +285,14 @@ public class AdminCommand implements CommandExecutor {
auth.setSalt(PasswordSecurity.userSalt.get(name)); auth.setSalt(PasswordSecurity.userSalt.get(name));
else auth.setSalt(""); else auth.setSalt("");
if (!database.saveAuth(auth)) { if (!database.saveAuth(auth)) {
m._(sender, "error"); m.send(sender, "error");
return true; return true;
} }
m._(sender, "registered"); m.send(sender, "registered");
ConsoleLogger.info(args[1] + " registered"); ConsoleLogger.info(args[1] + " registered");
} catch (NoSuchAlgorithmException ex) { } catch (NoSuchAlgorithmException ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
m._(sender, "error"); m.send(sender, "error");
} }
return true; return true;
} else if (args[0].equalsIgnoreCase("getemail")) { } else if (args[0].equalsIgnoreCase("getemail")) {
@ -303,7 +303,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) {
m._(sender, "unknown_user"); m.send(sender, "unknown_user");
return true; return true;
} }
sender.sendMessage("[AuthMe] " + args[1] + " email : " + getAuth.getEmail()); sender.sendMessage("[AuthMe] " + args[1] + " email : " + getAuth.getEmail());
@ -316,12 +316,12 @@ 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) {
m._(sender, "unknown_user"); m.send(sender, "unknown_user");
return true; return true;
} }
getAuth.setEmail(args[2]); getAuth.setEmail(args[2]);
if (!database.updateEmail(getAuth)) { if (!database.updateEmail(getAuth)) {
m._(sender, "error"); m.send(sender, "error");
return true; return true;
} }
if (PlayerCache.getInstance().getAuth(playername) != null) if (PlayerCache.getInstance().getAuth(playername) != null)
@ -409,7 +409,7 @@ public class AdminCommand implements CommandExecutor {
auth = database.getAuth(name); auth = database.getAuth(name);
} }
if (auth == null) { if (auth == null) {
m._(sender, "unknown_user"); m.send(sender, "unknown_user");
return true; return true;
} }
auth.setHash(hash); auth.setHash(hash);
@ -418,14 +418,14 @@ public class AdminCommand implements CommandExecutor {
database.updateSalt(auth); database.updateSalt(auth);
} }
if (!database.updatePassword(auth)) { if (!database.updatePassword(auth)) {
m._(sender, "error"); m.send(sender, "error");
return true; return true;
} }
sender.sendMessage("pwd_changed"); sender.sendMessage("pwd_changed");
ConsoleLogger.info(args[1] + "'s password changed"); ConsoleLogger.info(args[1] + "'s password changed");
} catch (NoSuchAlgorithmException ex) { } catch (NoSuchAlgorithmException ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
m._(sender, "error"); m.send(sender, "error");
} }
return true; return true;
} else if (args[0].equalsIgnoreCase("unregister") || args[0].equalsIgnoreCase("unreg") || args[0].equalsIgnoreCase("del")) { } else if (args[0].equalsIgnoreCase("unregister") || args[0].equalsIgnoreCase("unreg") || args[0].equalsIgnoreCase("del")) {
@ -435,11 +435,11 @@ public class AdminCommand implements CommandExecutor {
} }
String name = args[1].toLowerCase(); String name = args[1].toLowerCase();
if (!database.isAuthAvailable(name)) { if (!database.isAuthAvailable(name)) {
m._(sender, "user_unknown"); m.send(sender, "user_unknown");
return true; return true;
} }
if (!database.removeAuth(name)) { if (!database.removeAuth(name)) {
m._(sender, "error"); m.send(sender, "error");
return true; return true;
} }
Player target = Bukkit.getPlayer(name); Player target = Bukkit.getPlayer(name);
@ -463,17 +463,17 @@ public class AdminCommand implements CommandExecutor {
BukkitTask id = sched.runTaskLater(plugin, new TimeoutTask(plugin, name), delay); BukkitTask id = sched.runTaskLater(plugin, new TimeoutTask(plugin, name), delay);
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
} }
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTask(plugin, new MessageTask(plugin, name, m._("reg_msg"), interval))); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTask(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval)));
if (Settings.applyBlindEffect) if (Settings.applyBlindEffect)
target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
m._(target, "unregistered"); m.send(target, "unregistered");
} else { } else {
// Player isn't online, do nothing else // Player isn't online, do nothing else
} }
} else { } else {
// Player does not exist, do nothing else // Player does not exist, do nothing else
} }
m._(sender, "unregistered"); m.send(sender, "unregistered");
ConsoleLogger.info(args[1] + " unregistered"); ConsoleLogger.info(args[1] + " unregistered");
return true; return true;
} else if (args[0].equalsIgnoreCase("purgelastpos")) { } else if (args[0].equalsIgnoreCase("purgelastpos")) {
@ -540,7 +540,7 @@ public class AdminCommand implements CommandExecutor {
} }
PlayerAuth auth = database.getAuth(args[1]); PlayerAuth auth = database.getAuth(args[1]);
if (auth == null) { if (auth == null) {
m._(sender, "unknown_user"); m.send(sender, "unknown_user");
return true; return true;
} }
auth.setQuitLocX(0D); auth.setQuitLocX(0D);

View File

@ -33,34 +33,34 @@ public class CaptchaCommand implements CommandExecutor {
String name = player.getName().toLowerCase(); String name = player.getName().toLowerCase();
if (args.length == 0) { if (args.length == 0) {
m._(player, "usage_captcha"); m.send(player, "usage_captcha");
return true; return true;
} }
if (PlayerCache.getInstance().isAuthenticated(name)) { if (PlayerCache.getInstance().isAuthenticated(name)) {
m._(player, "logged_in"); m.send(player, "logged_in");
return true; return true;
} }
if (!plugin.authmePermissible(player, "authme." + label.toLowerCase())) { if (!plugin.authmePermissible(player, "authme." + label.toLowerCase())) {
m._(player, "no_perm"); m.send(player, "no_perm");
return true; return true;
} }
if (!Settings.useCaptcha) { if (!Settings.useCaptcha) {
m._(player, "usage_log"); m.send(player, "usage_log");
return true; return true;
} }
if (!plugin.cap.containsKey(name)) { if (!plugin.cap.containsKey(name)) {
m._(player, "usage_log"); m.send(player, "usage_log");
return true; return true;
} }
if (Settings.useCaptcha && !args[0].equals(plugin.cap.get(name))) { if (Settings.useCaptcha && !args[0].equals(plugin.cap.get(name))) {
plugin.cap.remove(name); plugin.cap.remove(name);
plugin.cap.put(name, rdm.nextString()); plugin.cap.put(name, rdm.nextString());
for (String s : m._("wrong_captcha")) { for (String s : m.send("wrong_captcha")) {
player.sendMessage(s.replace("THE_CAPTCHA", plugin.cap.get(name))); player.sendMessage(s.replace("THE_CAPTCHA", plugin.cap.get(name)));
} }
return true; return true;
@ -70,8 +70,8 @@ public class CaptchaCommand implements CommandExecutor {
plugin.cap.remove(name); plugin.cap.remove(name);
} catch (NullPointerException npe) { } catch (NullPointerException npe) {
} }
m._(player, "valid_captcha"); m.send(player, "valid_captcha");
m._(player, "login_msg"); m.send(player, "login_msg");
return true; return true;
} }

View File

@ -37,19 +37,19 @@ public class ChangePasswordCommand implements CommandExecutor {
} }
if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) { if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) {
m._(sender, "no_perm"); m.send(sender, "no_perm");
return true; return true;
} }
Player player = (Player) sender; Player player = (Player) sender;
String name = player.getName().toLowerCase(); String name = player.getName().toLowerCase();
if (!PlayerCache.getInstance().isAuthenticated(name)) { if (!PlayerCache.getInstance().isAuthenticated(name)) {
m._(player, "not_logged_in"); m.send(player, "not_logged_in");
return true; return true;
} }
if (args.length != 2) { if (args.length != 2) {
m._(player, "usage_changepassword"); m.send(player, "usage_changepassword");
return true; return true;
} }
@ -63,22 +63,22 @@ public class ChangePasswordCommand implements CommandExecutor {
auth.setSalt(PasswordSecurity.userSalt.get(name)); auth.setSalt(PasswordSecurity.userSalt.get(name));
else auth.setSalt(""); else auth.setSalt("");
if (!database.updatePassword(auth)) { if (!database.updatePassword(auth)) {
m._(player, "error"); m.send(player, "error");
return true; return true;
} }
database.updateSalt(auth); database.updateSalt(auth);
PlayerCache.getInstance().updatePlayer(auth); PlayerCache.getInstance().updatePlayer(auth);
m._(player, "pwd_changed"); m.send(player, "pwd_changed");
ConsoleLogger.info(player.getName() + " changed his password"); ConsoleLogger.info(player.getName() + " changed his password");
if (plugin.notifications != null) { if (plugin.notifications != null) {
plugin.notifications.showNotification(new Notification("[AuthMe] " + player.getName() + " change his password!")); plugin.notifications.showNotification(new Notification("[AuthMe] " + player.getName() + " change his password!"));
} }
} else { } else {
m._(player, "wrong_pwd"); m.send(player, "wrong_pwd");
} }
} catch (NoSuchAlgorithmException ex) { } catch (NoSuchAlgorithmException ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
m._(sender, "error"); m.send(sender, "error");
} }
return true; return true;
} }

View File

@ -38,7 +38,7 @@ public class ConverterCommand implements CommandExecutor {
} }
if (!plugin.authmePermissible(sender, "authme.admin.converter")) { if (!plugin.authmePermissible(sender, "authme.admin.converter")) {
m._(sender, "no_perm"); m.send(sender, "no_perm");
return true; return true;
} }
@ -49,7 +49,7 @@ public class ConverterCommand implements CommandExecutor {
ConvertType type = ConvertType.fromName(args[0]); ConvertType type = ConvertType.fromName(args[0]);
if (type == null) { if (type == null) {
m._(sender, "error"); m.send(sender, "error");
return true; return true;
} }
Converter converter = null; Converter converter = null;
@ -82,7 +82,7 @@ public class ConverterCommand implements CommandExecutor {
break; break;
} }
if (converter == null) { if (converter == null) {
m._(sender, "error"); m.send(sender, "error");
return true; return true;
} }
Bukkit.getScheduler().runTaskAsynchronously(plugin, converter); Bukkit.getScheduler().runTaskAsynchronously(plugin, converter);

View File

@ -41,7 +41,7 @@ public class EmailCommand implements CommandExecutor {
} }
if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) { if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) {
m._(sender, "no_perm"); m.send(sender, "no_perm");
return true; return true;
} }
@ -49,105 +49,105 @@ public class EmailCommand implements CommandExecutor {
String name = player.getName(); String name = player.getName();
if (args.length == 0) { if (args.length == 0) {
m._(player, "usage_email_add"); m.send(player, "usage_email_add");
m._(player, "usage_email_change"); m.send(player, "usage_email_change");
m._(player, "usage_email_recovery"); m.send(player, "usage_email_recovery");
return true; return true;
} }
if (args[0].equalsIgnoreCase("add")) { if (args[0].equalsIgnoreCase("add")) {
if (args.length != 3) { if (args.length != 3) {
m._(player, "usage_email_add"); m.send(player, "usage_email_add");
return true; return true;
} }
if (Settings.getmaxRegPerEmail > 0) { if (Settings.getmaxRegPerEmail > 0) {
if (!plugin.authmePermissible(sender, "authme.allow2accounts") && data.getAllAuthsByEmail(args[1]).size() >= Settings.getmaxRegPerEmail) { if (!plugin.authmePermissible(sender, "authme.allow2accounts") && data.getAllAuthsByEmail(args[1]).size() >= Settings.getmaxRegPerEmail) {
m._(player, "max_reg"); m.send(player, "max_reg");
return true; return true;
} }
} }
if (args[1].equals(args[2]) && PlayerCache.getInstance().isAuthenticated(name)) { if (args[1].equals(args[2]) && PlayerCache.getInstance().isAuthenticated(name)) {
PlayerAuth auth = PlayerCache.getInstance().getAuth(name); PlayerAuth auth = PlayerCache.getInstance().getAuth(name);
if (auth.getEmail() == null || (!auth.getEmail().equals("your@email.com") && !auth.getEmail().isEmpty())) { if (auth.getEmail() == null || (!auth.getEmail().equals("your@email.com") && !auth.getEmail().isEmpty())) {
m._(player, "usage_email_change"); m.send(player, "usage_email_change");
return true; return true;
} }
if (!Settings.isEmailCorrect(args[1])) { if (!Settings.isEmailCorrect(args[1])) {
m._(player, "email_invalid"); m.send(player, "email_invalid");
return true; return true;
} }
auth.setEmail(args[1]); auth.setEmail(args[1]);
if (!data.updateEmail(auth)) { if (!data.updateEmail(auth)) {
m._(player, "error"); m.send(player, "error");
return true; return true;
} }
PlayerCache.getInstance().updatePlayer(auth); PlayerCache.getInstance().updatePlayer(auth);
m._(player, "email_added"); m.send(player, "email_added");
player.sendMessage(auth.getEmail()); player.sendMessage(auth.getEmail());
} else if (PlayerCache.getInstance().isAuthenticated(name)) { } else if (PlayerCache.getInstance().isAuthenticated(name)) {
m._(player, "email_confirm"); m.send(player, "email_confirm");
} else { } else {
if (!data.isAuthAvailable(name)) { if (!data.isAuthAvailable(name)) {
m._(player, "login_msg"); m.send(player, "login_msg");
} else { } else {
m._(player, "reg_email_msg"); m.send(player, "reg_email_msg");
} }
} }
} else if (args[0].equalsIgnoreCase("change")) { } else if (args[0].equalsIgnoreCase("change")) {
if (args.length != 3) { if (args.length != 3) {
m._(player, "usage_email_change"); m.send(player, "usage_email_change");
return true; return true;
} }
if (Settings.getmaxRegPerEmail > 0) { if (Settings.getmaxRegPerEmail > 0) {
if (!plugin.authmePermissible(sender, "authme.allow2accounts") && data.getAllAuthsByEmail(args[2]).size() >= Settings.getmaxRegPerEmail) { if (!plugin.authmePermissible(sender, "authme.allow2accounts") && data.getAllAuthsByEmail(args[2]).size() >= Settings.getmaxRegPerEmail) {
m._(player, "max_reg"); m.send(player, "max_reg");
return true; return true;
} }
} }
if (PlayerCache.getInstance().isAuthenticated(name)) { if (PlayerCache.getInstance().isAuthenticated(name)) {
PlayerAuth auth = PlayerCache.getInstance().getAuth(name); PlayerAuth auth = PlayerCache.getInstance().getAuth(name);
if (auth.getEmail() == null || auth.getEmail().equals("your@email.com") || auth.getEmail().isEmpty()) { if (auth.getEmail() == null || auth.getEmail().equals("your@email.com") || auth.getEmail().isEmpty()) {
m._(player, "usage_email_add"); m.send(player, "usage_email_add");
return true; return true;
} }
if (!args[1].equals(auth.getEmail())) { if (!args[1].equals(auth.getEmail())) {
m._(player, "old_email_invalid"); m.send(player, "old_email_invalid");
return true; return true;
} }
if (!Settings.isEmailCorrect(args[2])) { if (!Settings.isEmailCorrect(args[2])) {
m._(player, "new_email_invalid"); m.send(player, "new_email_invalid");
return true; return true;
} }
auth.setEmail(args[2]); auth.setEmail(args[2]);
if (!data.updateEmail(auth)) { if (!data.updateEmail(auth)) {
m._(player, "error"); m.send(player, "error");
return true; return true;
} }
PlayerCache.getInstance().updatePlayer(auth); PlayerCache.getInstance().updatePlayer(auth);
m._(player, "email_changed"); m.send(player, "email_changed");
player.sendMessage(m._("email_defined") + auth.getEmail()); player.sendMessage(m.send("email_defined") + auth.getEmail());
} else if (PlayerCache.getInstance().isAuthenticated(name)) { } else if (PlayerCache.getInstance().isAuthenticated(name)) {
m._(player, "email_confirm"); m.send(player, "email_confirm");
} else { } else {
if (!data.isAuthAvailable(name)) { if (!data.isAuthAvailable(name)) {
m._(player, "login_msg"); m.send(player, "login_msg");
} else { } else {
m._(player, "reg_email_msg"); m.send(player, "reg_email_msg");
} }
} }
} }
if (args[0].equalsIgnoreCase("recovery")) { if (args[0].equalsIgnoreCase("recovery")) {
if (args.length != 2) { if (args.length != 2) {
m._(player, "usage_email_recovery"); m.send(player, "usage_email_recovery");
return true; return true;
} }
if (plugin.mail == null) { if (plugin.mail == null) {
m._(player, "error"); m.send(player, "error");
return true; return true;
} }
if (data.isAuthAvailable(name)) { if (data.isAuthAvailable(name)) {
if (PlayerCache.getInstance().isAuthenticated(name)) { if (PlayerCache.getInstance().isAuthenticated(name)) {
m._(player, "logged_in"); m.send(player, "logged_in");
return true; return true;
} }
try { try {
@ -160,16 +160,16 @@ public class EmailCommand implements CommandExecutor {
} else if (data.isAuthAvailable(name)) { } else if (data.isAuthAvailable(name)) {
auth = data.getAuth(name); auth = data.getAuth(name);
} else { } else {
m._(player, "unknown_user"); m.send(player, "unknown_user");
return true; return true;
} }
if (Settings.getmailAccount.equals("") || Settings.getmailAccount.isEmpty()) { if (Settings.getmailAccount.equals("") || Settings.getmailAccount.isEmpty()) {
m._(player, "error"); m.send(player, "error");
return true; return true;
} }
if (!args[1].equalsIgnoreCase(auth.getEmail()) || args[1].equalsIgnoreCase("your@email.com") || auth.getEmail().equalsIgnoreCase("your@email.com")) { if (!args[1].equalsIgnoreCase(auth.getEmail()) || args[1].equalsIgnoreCase("your@email.com") || auth.getEmail().equalsIgnoreCase("your@email.com")) {
m._(player, "email_invalid"); m.send(player, "email_invalid");
return true; return true;
} }
final String finalhashnew = hashnew; final String finalhashnew = hashnew;
@ -188,16 +188,16 @@ public class EmailCommand implements CommandExecutor {
}); });
} }
plugin.mail.main(auth, thePass); plugin.mail.main(auth, thePass);
m._(player, "email_send"); m.send(player, "email_send");
} catch (NoSuchAlgorithmException ex) { } catch (NoSuchAlgorithmException ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
m._(sender, "error"); m.send(sender, "error");
} catch (NoClassDefFoundError ncdfe) { } catch (NoClassDefFoundError ncdfe) {
ConsoleLogger.showError(ncdfe.getMessage()); ConsoleLogger.showError(ncdfe.getMessage());
m._(sender, "error"); m.send(sender, "error");
} }
} else { } else {
m._(player, "reg_email_msg"); m.send(player, "reg_email_msg");
} }
} }
return true; return true;

View File

@ -27,12 +27,12 @@ public class LoginCommand implements CommandExecutor {
final Player player = (Player) sender; final Player player = (Player) sender;
if (args.length == 0) { if (args.length == 0) {
m._(player, "usage_log"); m.send(player, "usage_log");
return true; return true;
} }
if (!plugin.authmePermissible(player, "authme." + label.toLowerCase())) { if (!plugin.authmePermissible(player, "authme." + label.toLowerCase())) {
m._(player, "no_perm"); m.send(player, "no_perm");
return true; return true;
} }
plugin.management.performLogin(player, args[0], false); plugin.management.performLogin(player, args[0], false);

View File

@ -52,7 +52,7 @@ public class LogoutCommand implements CommandExecutor {
} }
if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) { if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) {
m._(sender, "no_perm"); m.send(sender, "no_perm");
return true; return true;
} }
@ -60,7 +60,7 @@ public class LogoutCommand implements CommandExecutor {
String name = player.getName().toLowerCase(); String name = player.getName().toLowerCase();
if (!PlayerCache.getInstance().isAuthenticated(name)) { if (!PlayerCache.getInstance().isAuthenticated(name)) {
m._(player, "not_logged_in"); m.send(player, "not_logged_in");
return true; return true;
} }
@ -106,7 +106,7 @@ public class LogoutCommand implements CommandExecutor {
BukkitTask id = sched.runTaskLater(plugin, new TimeoutTask(plugin, name), delay); BukkitTask id = sched.runTaskLater(plugin, new TimeoutTask(plugin, name), delay);
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
} }
BukkitTask msgT = sched.runTask(plugin, new MessageTask(plugin, name, m._("login_msg"), interval)); BukkitTask msgT = sched.runTask(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval));
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT);
try { try {
if (player.isInsideVehicle()) if (player.isInsideVehicle())
@ -125,7 +125,7 @@ public class LogoutCommand implements CommandExecutor {
Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player)); Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player));
} }
}); });
m._(player, "logout"); m.send(player, "logout");
ConsoleLogger.info(player.getDisplayName() + " logged out"); ConsoleLogger.info(player.getDisplayName() + " logged out");
if (plugin.notifications != null) { if (plugin.notifications != null) {
plugin.notifications.showNotification(new Notification("[AuthMe] " + player.getName() + " logged out!")); plugin.notifications.showNotification(new Notification("[AuthMe] " + player.getName() + " logged out!"));

View File

@ -29,7 +29,7 @@ public class PasspartuCommand implements CommandExecutor {
String[] args) { String[] args) {
if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) { if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) {
m._(sender, "no_perm"); m.send(sender, "no_perm");
return true; return true;
} }

View File

@ -29,27 +29,27 @@ public class RegisterCommand implements CommandExecutor {
return true; return true;
} }
if (args.length == 0) { if (args.length == 0) {
m._(sender, "usage_reg"); m.send(sender, "usage_reg");
} }
if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) { if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) {
m._(sender, "no_perm"); m.send(sender, "no_perm");
return true; return true;
} }
final Player player = (Player) sender; final Player player = (Player) sender;
if (Settings.emailRegistration && !Settings.getmailAccount.isEmpty()) { if (Settings.emailRegistration && !Settings.getmailAccount.isEmpty()) {
if (Settings.doubleEmailCheck) { if (Settings.doubleEmailCheck) {
if (args.length < 2) { if (args.length < 2) {
m._(player, "usage_reg"); m.send(player, "usage_reg");
return true; return true;
} }
if (!args[0].equals(args[1])) { if (!args[0].equals(args[1])) {
m._(player, "usage_reg"); m.send(player, "usage_reg");
return true; return true;
} }
} }
final String email = args[0]; final String email = args[0];
if (!Settings.isEmailCorrect(email)) { if (!Settings.isEmailCorrect(email)) {
m._(player, "email_invalid"); m.send(player, "email_invalid");
return true; return true;
} }
RandomString rand = new RandomString(Settings.getRecoveryPassLength); RandomString rand = new RandomString(Settings.getRecoveryPassLength);
@ -58,12 +58,12 @@ public class RegisterCommand implements CommandExecutor {
return true; return true;
} }
if (args.length == 0 || (Settings.getEnablePasswordVerifier && args.length < 2)) { if (args.length == 0 || (Settings.getEnablePasswordVerifier && args.length < 2)) {
m._(player, "usage_reg"); m.send(player, "usage_reg");
return true; return true;
} }
if (args.length > 1 && Settings.getEnablePasswordVerifier) if (args.length > 1 && Settings.getEnablePasswordVerifier)
if (!args[0].equals(args[1])) { if (!args[0].equals(args[1])) {
m._(player, "password_error"); m.send(player, "password_error");
return true; return true;
} }
plugin.management.performRegister(player, args[0], ""); plugin.management.performRegister(player, args[0], "");

View File

@ -51,7 +51,7 @@ public class UnregisterCommand implements CommandExecutor {
} }
if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) { if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) {
m._(sender, "no_perm"); m.send(sender, "no_perm");
return true; return true;
} }
@ -59,12 +59,12 @@ public class UnregisterCommand implements CommandExecutor {
String name = player.getName().toLowerCase(); String name = player.getName().toLowerCase();
if (!PlayerCache.getInstance().isAuthenticated(name)) { if (!PlayerCache.getInstance().isAuthenticated(name)) {
m._(player, "not_logged_in"); m.send(player, "not_logged_in");
return true; return true;
} }
if (args.length != 1) { if (args.length != 1) {
m._(player, "usage_unreg"); m.send(player, "usage_unreg");
return true; return true;
} }
try { try {
@ -96,8 +96,8 @@ public class UnregisterCommand implements CommandExecutor {
BukkitTask id = sched.runTaskLater(plugin, new TimeoutTask(plugin, name), delay); BukkitTask id = sched.runTaskLater(plugin, new TimeoutTask(plugin, name), delay);
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
} }
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTask(plugin, new MessageTask(plugin, name, m._("reg_msg"), interval))); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTask(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval)));
m._(player, "unregistered"); m.send(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!"));
@ -115,7 +115,7 @@ public class UnregisterCommand implements CommandExecutor {
} }
if (Settings.applyBlindEffect) if (Settings.applyBlindEffect)
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
m._(player, "unregistered"); m.send(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!"));
@ -133,7 +133,7 @@ public class UnregisterCommand implements CommandExecutor {
} }
return true; return true;
} else { } else {
m._(player, "wrong_pwd"); m.send(player, "wrong_pwd");
} }
} catch (NoSuchAlgorithmException ex) { } catch (NoSuchAlgorithmException ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());

View File

@ -44,7 +44,7 @@ public class SqlToFlat implements Converter {
return; return;
} catch (Exception ex) { } catch (Exception ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
Messages.getInstance()._(sender, "error"); Messages.getInstance().send(sender, "error");
return; return;
} }
} }

View File

@ -132,16 +132,16 @@ public class AuthMePlayerListener implements Listener {
String cmd = event.getMessage().split(" ")[0]; String cmd = event.getMessage().split(" ")[0];
if (data.isAuthAvailable(name)) { if (data.isAuthAvailable(name)) {
m._(player, "login_msg"); m.send(player, "login_msg");
} else { } else {
if (!Settings.isForcedRegistrationEnabled) { if (!Settings.isForcedRegistrationEnabled) {
return; return;
} }
if (Settings.emailRegistration) { if (Settings.emailRegistration) {
m._(player, "reg_email_msg"); m.send(player, "reg_email_msg");
return; return;
} else { } else {
m._(player, "reg_msg"); m.send(player, "reg_msg");
return; return;
} }
} }
@ -169,16 +169,16 @@ public class AuthMePlayerListener implements Listener {
String cmd = event.getMessage().split(" ")[0]; String cmd = event.getMessage().split(" ")[0];
if (data.isAuthAvailable(name)) { if (data.isAuthAvailable(name)) {
m._(player, "login_msg"); m.send(player, "login_msg");
} else { } else {
if (!Settings.isForcedRegistrationEnabled) { if (!Settings.isForcedRegistrationEnabled) {
return; return;
} }
if (Settings.emailRegistration) { if (Settings.emailRegistration) {
m._(player, "reg_email_msg"); m.send(player, "reg_email_msg");
return; return;
} else { } else {
m._(player, "reg_msg"); m.send(player, "reg_msg");
return; return;
} }
} }
@ -206,16 +206,16 @@ public class AuthMePlayerListener implements Listener {
String cmd = event.getMessage().split(" ")[0]; String cmd = event.getMessage().split(" ")[0];
if (data.isAuthAvailable(name)) { if (data.isAuthAvailable(name)) {
m._(player, "login_msg"); m.send(player, "login_msg");
} else { } else {
if (!Settings.isForcedRegistrationEnabled) { if (!Settings.isForcedRegistrationEnabled) {
return; return;
} }
if (Settings.emailRegistration) { if (Settings.emailRegistration) {
m._(player, "reg_email_msg"); m.send(player, "reg_email_msg");
return; return;
} else { } else {
m._(player, "reg_msg"); m.send(player, "reg_msg");
return; return;
} }
} }
@ -243,16 +243,16 @@ public class AuthMePlayerListener implements Listener {
String cmd = event.getMessage().split(" ")[0]; String cmd = event.getMessage().split(" ")[0];
if (data.isAuthAvailable(name)) { if (data.isAuthAvailable(name)) {
m._(player, "login_msg"); m.send(player, "login_msg");
} else { } else {
if (!Settings.isForcedRegistrationEnabled) { if (!Settings.isForcedRegistrationEnabled) {
return; return;
} }
if (Settings.emailRegistration) { if (Settings.emailRegistration) {
m._(player, "reg_email_msg"); m.send(player, "reg_email_msg");
return; return;
} else { } else {
m._(player, "reg_msg"); m.send(player, "reg_msg");
return; return;
} }
} }
@ -281,16 +281,16 @@ public class AuthMePlayerListener implements Listener {
String cmd = event.getMessage().split(" ")[0]; String cmd = event.getMessage().split(" ")[0];
if (data.isAuthAvailable(name)) { if (data.isAuthAvailable(name)) {
m._(player, "login_msg"); m.send(player, "login_msg");
} else { } else {
if (!Settings.isForcedRegistrationEnabled) { if (!Settings.isForcedRegistrationEnabled) {
return; return;
} }
if (Settings.emailRegistration) { if (Settings.emailRegistration) {
m._(player, "reg_email_msg"); m.send(player, "reg_email_msg");
return; return;
} else { } else {
m._(player, "reg_msg"); m.send(player, "reg_msg");
return; return;
} }
} }
@ -318,15 +318,15 @@ public class AuthMePlayerListener implements Listener {
String cmd = event.getMessage().split(" ")[0]; String cmd = event.getMessage().split(" ")[0];
if (data.isAuthAvailable(name)) { if (data.isAuthAvailable(name)) {
m._(player, "login_msg"); m.send(player, "login_msg");
} else { } else {
if (!Settings.isForcedRegistrationEnabled) { if (!Settings.isForcedRegistrationEnabled) {
return; return;
} }
if (Settings.emailRegistration) { if (Settings.emailRegistration) {
m._(player, "reg_email_msg"); m.send(player, "reg_email_msg");
} else { } else {
m._(player, "reg_msg"); m.send(player, "reg_msg");
} }
} }
@ -405,7 +405,7 @@ public class AuthMePlayerListener implements Listener {
if (!Settings.countriesBlacklist.isEmpty()) { if (!Settings.countriesBlacklist.isEmpty()) {
String code = plugin.getCountryCode(event.getAddress().getHostAddress()); String code = plugin.getCountryCode(event.getAddress().getHostAddress());
if (((code == null) || (Settings.countriesBlacklist.contains(code) && !API.isRegistered(name))) && !plugin.authmePermissible(player, "authme.bypassantibot")) { if (((code == null) || (Settings.countriesBlacklist.contains(code) && !API.isRegistered(name))) && !plugin.authmePermissible(player, "authme.bypassantibot")) {
event.setKickMessage(m._("country_banned")[0]); event.setKickMessage(m.send("country_banned")[0]);
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
return; return;
} }
@ -413,7 +413,7 @@ public class AuthMePlayerListener implements Listener {
if (Settings.enableProtection && !Settings.countries.isEmpty()) { if (Settings.enableProtection && !Settings.countries.isEmpty()) {
String code = plugin.getCountryCode(event.getAddress().getHostAddress()); String code = plugin.getCountryCode(event.getAddress().getHostAddress());
if (((code == null) || (!Settings.countries.contains(code) && !API.isRegistered(name))) && !plugin.authmePermissible(player, "authme.bypassantibot")) { if (((code == null) || (!Settings.countries.contains(code) && !API.isRegistered(name))) && !plugin.authmePermissible(player, "authme.bypassantibot")) {
event.setKickMessage(m._("country_banned")[0]); event.setKickMessage(m.send("country_banned")[0]);
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
return; return;
} }
@ -421,14 +421,14 @@ public class AuthMePlayerListener implements Listener {
if (Settings.isKickNonRegisteredEnabled) { if (Settings.isKickNonRegisteredEnabled) {
if (!data.isAuthAvailable(name)) { if (!data.isAuthAvailable(name)) {
event.setKickMessage(m._("reg_only")[0]); event.setKickMessage(m.send("reg_only")[0]);
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
return; return;
} }
} }
if (player.isOnline() && Settings.isForceSingleSessionEnabled) { if (player.isOnline() && Settings.isForceSingleSessionEnabled) {
event.setKickMessage(m._("same_nick")[0]); event.setKickMessage(m.send("same_nick")[0]);
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
return; return;
} }
@ -446,7 +446,7 @@ public class AuthMePlayerListener implements Listener {
// joined with same nick of online player // joined with same nick of online player
if (player.isOnline() && Settings.isForceSingleSessionEnabled) { if (player.isOnline() && Settings.isForceSingleSessionEnabled) {
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase());
event.setKickMessage(m._("same_nick")[0]); event.setKickMessage(m.send("same_nick")[0]);
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) { if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) {
utils.addNormal(player, limbo.getGroup()); utils.addNormal(player, limbo.getGroup());
@ -461,14 +461,14 @@ public class AuthMePlayerListener implements Listener {
if (name.length() > max || name.length() < min) { if (name.length() > max || name.length() < min) {
event.setKickMessage(m._("name_len")[0]); event.setKickMessage(m.send("name_len")[0]);
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
return; return;
} }
try { try {
if (!player.getName().matches(regex) || name.equals("Player")) { if (!player.getName().matches(regex) || name.equals("Player")) {
try { try {
event.setKickMessage(m._("regex")[0].replace("REG_EX", regex)); event.setKickMessage(m.send("regex")[0].replace("REG_EX", regex));
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
} catch (Exception exc) { } catch (Exception exc) {
event.setKickMessage("allowed char : " + regex); event.setKickMessage("allowed char : " + regex);
@ -483,7 +483,7 @@ public class AuthMePlayerListener implements Listener {
return; return;
} }
try { try {
event.setKickMessage(m._("regex")[0].replace("REG_EX", regex)); event.setKickMessage(m.send("regex")[0].replace("REG_EX", regex));
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
} catch (Exception exc) { } catch (Exception exc) {
event.setKickMessage("allowed char : " + regex); event.setKickMessage("allowed char : " + regex);
@ -511,7 +511,7 @@ public class AuthMePlayerListener implements Listener {
if (player.isBanned()) if (player.isBanned())
return; return;
if (!plugin.authmePermissible(player, "authme.vip")) { if (!plugin.authmePermissible(player, "authme.vip")) {
event.setKickMessage(m._("kick_fullserver")[0]); event.setKickMessage(m.send("kick_fullserver")[0]);
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_FULL); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_FULL);
return; return;
} }
@ -522,12 +522,12 @@ public class AuthMePlayerListener implements Listener {
} else { } else {
final Player pl = plugin.generateKickPlayer(plugin.getServer().getOnlinePlayers()); final Player pl = plugin.generateKickPlayer(plugin.getServer().getOnlinePlayers());
if (pl != null) { if (pl != null) {
pl.kickPlayer(m._("kick_forvip")[0]); pl.kickPlayer(m.send("kick_forvip")[0]);
event.allow(); event.allow();
return; return;
} else { } else {
ConsoleLogger.info("The player " + player.getName() + " wants to join, but the server is full"); ConsoleLogger.info("The player " + player.getName() + " wants to join, but the server is full");
event.setKickMessage(m._("kick_fullserver")[0]); event.setKickMessage(m.send("kick_fullserver")[0]);
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_FULL); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_FULL);
return; return;
} }
@ -541,7 +541,7 @@ public class AuthMePlayerListener implements Listener {
return; return;
if (antibot.keySet().size() > Settings.antiBotSensibility) { if (antibot.keySet().size() > Settings.antiBotSensibility) {
plugin.switchAntiBotMod(true); plugin.switchAntiBotMod(true);
for (String s : m._("antibot_auto_enabled")) for (String s : m.send("antibot_auto_enabled"))
Bukkit.broadcastMessage(s); Bukkit.broadcastMessage(s);
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@ -550,7 +550,7 @@ public class AuthMePlayerListener implements Listener {
if (plugin.antibotMod) { if (plugin.antibotMod) {
plugin.switchAntiBotMod(false); plugin.switchAntiBotMod(false);
antibot.clear(); antibot.clear();
for (String s : m._("antibot_auto_disabled")) for (String s : m.send("antibot_auto_disabled"))
Bukkit.broadcastMessage(s.replace("%m", "" + Settings.antiBotDuration)); Bukkit.broadcastMessage(s.replace("%m", "" + Settings.antiBotDuration));
} }
} }
@ -622,7 +622,7 @@ public class AuthMePlayerListener implements Listener {
PlayerCache.getInstance().addPlayer(auth); PlayerCache.getInstance().addPlayer(auth);
data.setLogged(name); data.setLogged(name);
} }
m._(player, "valid_session"); m.send(player, "valid_session");
// Restore Permission Group // Restore Permission Group
utils.setGroup(player, Utils.groupType.LOGGEDIN); utils.setGroup(player, Utils.groupType.LOGGEDIN);
plugin.getServer().getPluginManager().callEvent(new SessionEvent(auth, true)); plugin.getServer().getPluginManager().callEvent(new SessionEvent(auth, true));
@ -632,7 +632,7 @@ public class AuthMePlayerListener implements Listener {
causeByAuthMe.put(name, true); causeByAuthMe.put(name, true);
player.setGameMode(gM); player.setGameMode(gM);
causeByAuthMe.put(name, false); causeByAuthMe.put(name, false);
player.kickPlayer(m._("unvalid_session")[0]); player.kickPlayer(m.send("unvalid_session")[0]);
return; return;
} else if (auth.getNickname().equalsIgnoreCase(name)) { } else if (auth.getNickname().equalsIgnoreCase(name)) {
if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) { if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) {
@ -648,7 +648,7 @@ public class AuthMePlayerListener implements Listener {
causeByAuthMe.put(name, true); causeByAuthMe.put(name, true);
player.setGameMode(gM); player.setGameMode(gM);
causeByAuthMe.put(name, false); causeByAuthMe.put(name, false);
player.kickPlayer(m._("unvalid_session")[0]); player.kickPlayer(m.send("unvalid_session")[0]);
return; return;
} }
} else { } else {
@ -724,9 +724,9 @@ public class AuthMePlayerListener implements Listener {
} }
String[] msg; String[] msg;
if (Settings.emailRegistration) { if (Settings.emailRegistration) {
msg = data.isAuthAvailable(name) ? m._("login_msg") : m._("reg_email_msg"); msg = data.isAuthAvailable(name) ? m.send("login_msg") : m.send("reg_email_msg");
} else { } else {
msg = data.isAuthAvailable(name) ? m._("login_msg") : m._("reg_msg"); msg = data.isAuthAvailable(name) ? m.send("login_msg") : m.send("reg_msg");
} }
int time = Settings.getRegistrationTimeout * 20; int time = Settings.getRegistrationTimeout * 20;
int msgInterval = Settings.getWarnMessageInterval; int msgInterval = Settings.getWarnMessageInterval;
@ -771,14 +771,14 @@ public class AuthMePlayerListener implements Listener {
return; return;
Block b = player.getLocation().getBlock(); Block b = player.getLocation().getBlock();
if (b.getType() == Material.PORTAL || b.getType() == Material.ENDER_PORTAL || b.getType() == Material.LAVA || b.getType() == Material.STATIONARY_LAVA) { if (b.getType() == Material.PORTAL || b.getType() == Material.ENDER_PORTAL || b.getType() == Material.LAVA || b.getType() == Material.STATIONARY_LAVA) {
m._(player, "unsafe_spawn"); m.send(player, "unsafe_spawn");
if (spawnLoc.getWorld() != null) if (spawnLoc.getWorld() != null)
player.teleport(spawnLoc); player.teleport(spawnLoc);
return; return;
} }
Block c = player.getLocation().add(0D, 1D, 0D).getBlock(); Block c = player.getLocation().add(0D, 1D, 0D).getBlock();
if (c.getType() == Material.PORTAL || c.getType() == Material.ENDER_PORTAL || c.getType() == Material.LAVA || c.getType() == Material.STATIONARY_LAVA) { if (c.getType() == Material.PORTAL || c.getType() == Material.ENDER_PORTAL || c.getType() == Material.LAVA || c.getType() == Material.STATIONARY_LAVA) {
m._(player, "unsafe_spawn"); m.send(player, "unsafe_spawn");
if (spawnLoc.getWorld() != null) if (spawnLoc.getWorld() != null)
player.teleport(spawnLoc); player.teleport(spawnLoc);
return; return;

View File

@ -29,12 +29,12 @@ public class AuthMeServerListener implements Listener {
return; return;
if (!Settings.countriesBlacklist.isEmpty()) { if (!Settings.countriesBlacklist.isEmpty()) {
if (Settings.countriesBlacklist.contains(plugin.getCountryCode(event.getAddress().getHostAddress()))) if (Settings.countriesBlacklist.contains(plugin.getCountryCode(event.getAddress().getHostAddress())))
event.setMotd(m._("country_banned")[0]); event.setMotd(m.send("country_banned")[0]);
} }
if (Settings.countries.contains(plugin.getCountryCode(event.getAddress().getHostAddress()))) { if (Settings.countries.contains(plugin.getCountryCode(event.getAddress().getHostAddress()))) {
event.setMotd(plugin.getServer().getMotd()); event.setMotd(plugin.getServer().getMotd());
} else { } else {
event.setMotd(m._("country_banned")[0]); event.setMotd(m.send("country_banned")[0]);
} }
} }

View File

@ -60,7 +60,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._("usage_captcha")) { for (String s : m.send("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;
@ -81,18 +81,18 @@ public class AsyncronousLogin {
*/ */
protected PlayerAuth preAuth() { protected PlayerAuth preAuth() {
if (PlayerCache.getInstance().isAuthenticated(name)) { if (PlayerCache.getInstance().isAuthenticated(name)) {
m._(player, "logged_in"); m.send(player, "logged_in");
return null; return null;
} }
if (!database.isAuthAvailable(name)) { if (!database.isAuthAvailable(name)) {
m._(player, "user_unknown"); m.send(player, "user_unknown");
if (LimboCache.getInstance().hasLimboPlayer(name)) { if (LimboCache.getInstance().hasLimboPlayer(name)) {
LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel(); LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel();
String[] msg; String[] msg;
if (Settings.emailRegistration) { if (Settings.emailRegistration) {
msg = m._("reg_email_msg"); msg = m.send("reg_email_msg");
} else { } else {
msg = m._("reg_msg"); msg = m.send("reg_msg");
} }
BukkitTask msgT = Bukkit.getScheduler().runTask(plugin, new MessageTask(plugin, name, msg, Settings.getWarnMessageInterval)); BukkitTask msgT = Bukkit.getScheduler().runTask(plugin, new MessageTask(plugin, name, msg, Settings.getWarnMessageInterval));
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT);
@ -101,17 +101,17 @@ public class AsyncronousLogin {
} }
if (Settings.getMaxLoginPerIp > 0 && !plugin.authmePermissible(player, "authme.allow2accounts") && !getIP().equalsIgnoreCase("127.0.0.1") && !getIP().equalsIgnoreCase("localhost")) { if (Settings.getMaxLoginPerIp > 0 && !plugin.authmePermissible(player, "authme.allow2accounts") && !getIP().equalsIgnoreCase("127.0.0.1") && !getIP().equalsIgnoreCase("localhost")) {
if (plugin.isLoggedIp(name, getIP())) { if (plugin.isLoggedIp(name, getIP())) {
m._(player, "logged_in"); m.send(player, "logged_in");
return null; return null;
} }
} }
PlayerAuth pAuth = database.getAuth(name); PlayerAuth pAuth = database.getAuth(name);
if (pAuth == null) { if (pAuth == null) {
m._(player, "user_unknown"); m.send(player, "user_unknown");
return null; return null;
} }
if (!Settings.getMySQLColumnGroup.isEmpty() && pAuth.getGroupId() == Settings.getNonActivatedGroup) { if (!Settings.getMySQLColumnGroup.isEmpty() && pAuth.getGroupId() == Settings.getNonActivatedGroup) {
m._(player, "vb_nonActiv"); m.send(player, "vb_nonActiv");
return null; return null;
} }
return pAuth; return pAuth;
@ -130,7 +130,7 @@ public class AsyncronousLogin {
passwordVerified = PasswordSecurity.comparePasswordWithHash(password, hash, realName); passwordVerified = PasswordSecurity.comparePasswordWithHash(password, hash, realName);
} catch (Exception ex) { } catch (Exception ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
m._(player, "error"); m.send(player, "error");
return; return;
} }
if (passwordVerified && player.isOnline()) { if (passwordVerified && player.isOnline()) {
@ -147,7 +147,7 @@ public class AsyncronousLogin {
} }
player.setNoDamageTicks(0); player.setNoDamageTicks(0);
m._(player, "login"); m.send(player, "login");
displayOtherAccounts(auth, player); displayOtherAccounts(auth, player);
@ -184,11 +184,11 @@ public class AsyncronousLogin {
if (AuthMePlayerListener.gameMode != null && AuthMePlayerListener.gameMode.containsKey(name)) { if (AuthMePlayerListener.gameMode != null && AuthMePlayerListener.gameMode.containsKey(name)) {
player.setGameMode(AuthMePlayerListener.gameMode.get(name)); player.setGameMode(AuthMePlayerListener.gameMode.get(name));
} }
player.kickPlayer(m._("wrong_pwd")[0]); player.kickPlayer(m.send("wrong_pwd")[0]);
} }
}); });
} else { } else {
m._(player, "wrong_pwd"); m.send(player, "wrong_pwd");
return; return;
} }
} else { } else {

View File

@ -42,23 +42,23 @@ public class AsyncronousRegister {
protected void preRegister() { protected void preRegister() {
if (PlayerCache.getInstance().isAuthenticated(name)) { if (PlayerCache.getInstance().isAuthenticated(name)) {
m._(player, "logged_in"); m.send(player, "logged_in");
allowRegister = false; allowRegister = false;
} }
if (!Settings.isRegistrationEnabled) { if (!Settings.isRegistrationEnabled) {
m._(player, "reg_disabled"); m.send(player, "reg_disabled");
allowRegister = false; allowRegister = false;
} }
String lowpass = password.toLowerCase(); String lowpass = password.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._(player, "password_error"); m.send(player, "password_error");
allowRegister = false; allowRegister = false;
} }
if (database.isAuthAvailable(name)) { if (database.isAuthAvailable(name)) {
m._(player, "user_regged"); m.send(player, "user_regged");
if (plugin.pllog.getStringList("players").contains(name)) { if (plugin.pllog.getStringList("players").contains(name)) {
plugin.pllog.getStringList("players").remove(name); plugin.pllog.getStringList("players").remove(name);
} }
@ -67,7 +67,7 @@ public class AsyncronousRegister {
if (Settings.getmaxRegPerIp > 0) { if (Settings.getmaxRegPerIp > 0) {
if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByIp(getIp()).size() >= Settings.getmaxRegPerIp && !getIp().equalsIgnoreCase("127.0.0.1") && !getIp().equalsIgnoreCase("localhost")) { if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByIp(getIp()).size() >= Settings.getmaxRegPerIp && !getIp().equalsIgnoreCase("127.0.0.1") && !getIp().equalsIgnoreCase("localhost")) {
m._(player, "max_reg"); m.send(player, "max_reg");
allowRegister = false; allowRegister = false;
} }
} }
@ -81,7 +81,7 @@ public class AsyncronousRegister {
if (!email.isEmpty() && email != "") { if (!email.isEmpty() && email != "") {
if (Settings.getmaxRegPerEmail > 0) { if (Settings.getmaxRegPerEmail > 0) {
if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) { if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) {
m._(player, "max_reg"); m.send(player, "max_reg");
return; return;
} }
} }
@ -94,7 +94,7 @@ public class AsyncronousRegister {
protected void emailRegister() { protected void emailRegister() {
if (Settings.getmaxRegPerEmail > 0) { if (Settings.getmaxRegPerEmail > 0) {
if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) { if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) {
m._(player, "max_reg"); m.send(player, "max_reg");
return; return;
} }
} }
@ -104,7 +104,7 @@ public class AsyncronousRegister {
auth = new PlayerAuth(name, hashnew, getIp(), 0, (int) player.getLocation().getX(), (int) player.getLocation().getY(), (int) player.getLocation().getZ(), player.getLocation().getWorld().getName(), email); auth = new PlayerAuth(name, hashnew, getIp(), 0, (int) player.getLocation().getX(), (int) player.getLocation().getY(), (int) player.getLocation().getZ(), player.getLocation().getWorld().getName(), email);
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
ConsoleLogger.showError(e.getMessage()); ConsoleLogger.showError(e.getMessage());
m._(player, "error"); m.send(player, "error");
return; return;
} }
if (PasswordSecurity.userSalt.containsKey(name)) { if (PasswordSecurity.userSalt.containsKey(name)) {
@ -121,12 +121,12 @@ public class AsyncronousRegister {
protected void passwordRegister() { protected void passwordRegister() {
if (password.length() < Settings.getPasswordMinLen || password.length() > Settings.passwordMaxLength) { if (password.length() < Settings.getPasswordMinLen || password.length() > Settings.passwordMaxLength) {
m._(player, "pass_len"); m.send(player, "pass_len");
return; return;
} }
if (!Settings.unsafePasswords.isEmpty()) { if (!Settings.unsafePasswords.isEmpty()) {
if (Settings.unsafePasswords.contains(password.toLowerCase())) { if (Settings.unsafePasswords.contains(password.toLowerCase())) {
m._(player, "password_error"); m.send(player, "password_error");
return; return;
} }
} }
@ -136,7 +136,7 @@ public class AsyncronousRegister {
hash = PasswordSecurity.getHash(Settings.getPasswordHash, password, name); hash = PasswordSecurity.getHash(Settings.getPasswordHash, password, name);
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
ConsoleLogger.showError(e.getMessage()); ConsoleLogger.showError(e.getMessage());
m._(player, "error"); m.send(player, "error");
return; return;
} }
if (Settings.getMySQLColumnSalt.isEmpty() && !PasswordSecurity.userSalt.containsKey(name)) { if (Settings.getMySQLColumnSalt.isEmpty() && !PasswordSecurity.userSalt.containsKey(name)) {
@ -145,7 +145,7 @@ public class AsyncronousRegister {
auth = new PlayerAuth(name, hash, PasswordSecurity.userSalt.get(name), getIp(), new Date().getTime()); auth = new PlayerAuth(name, hash, PasswordSecurity.userSalt.get(name), getIp(), new Date().getTime());
} }
if (!database.saveAuth(auth)) { if (!database.saveAuth(auth)) {
m._(player, "error"); m.send(player, "error");
return; return;
} }
if (!Settings.forceRegLogin) { if (!Settings.forceRegLogin) {

View File

@ -33,7 +33,7 @@ public class ProcessSyncronousEmailRegister implements Runnable {
if (!Settings.getRegisteredGroup.isEmpty()) { if (!Settings.getRegisteredGroup.isEmpty()) {
Utils.getInstance().setGroup(player, Utils.groupType.REGISTERED); Utils.getInstance().setGroup(player, Utils.groupType.REGISTERED);
} }
m._(player, "vb_nonActiv"); m.send(player, "vb_nonActiv");
int time = Settings.getRegistrationTimeout * 20; int time = Settings.getRegistrationTimeout * 20;
int msgInterval = Settings.getWarnMessageInterval; int msgInterval = Settings.getWarnMessageInterval;
if (time != 0) { if (time != 0) {
@ -43,7 +43,7 @@ public class ProcessSyncronousEmailRegister implements Runnable {
} }
LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel(); LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel();
BukkitTask nwMsg = Bukkit.getScheduler().runTask(plugin, new MessageTask(plugin, name, m._("login_msg"), msgInterval)); BukkitTask nwMsg = Bukkit.getScheduler().runTask(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval));
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg);
player.saveData(); player.saveData();
if (!Settings.noConsoleSpam) if (!Settings.noConsoleSpam)

View File

@ -70,7 +70,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
BukkitTask id = sched.runTaskLater(plugin, new TimeoutTask(plugin, name), delay); BukkitTask id = sched.runTaskLater(plugin, new TimeoutTask(plugin, name), delay);
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
} }
BukkitTask msgT = sched.runTask(plugin, new MessageTask(plugin, name, m._("login_msg"), interval)); BukkitTask msgT = sched.runTask(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval));
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT);
try { try {
plugin.pllog.removePlayer(name); plugin.pllog.removePlayer(name);
@ -104,9 +104,9 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
if (!Settings.getRegisteredGroup.isEmpty()) { if (!Settings.getRegisteredGroup.isEmpty()) {
Utils.getInstance().setGroup(player, Utils.groupType.REGISTERED); Utils.getInstance().setGroup(player, Utils.groupType.REGISTERED);
} }
m._(player, "registered"); m.send(player, "registered");
if (!Settings.getmailAccount.isEmpty()) if (!Settings.getmailAccount.isEmpty())
m._(player, "add_email"); m.send(player, "add_email");
if (player.getGameMode() != GameMode.CREATIVE && !Settings.isMovementAllowed) { if (player.getGameMode() != GameMode.CREATIVE && !Settings.isMovementAllowed) {
player.setAllowFlight(false); player.setAllowFlight(false);
player.setFlying(false); player.setFlying(false);
@ -125,7 +125,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
// Kick Player after Registration is enabled, kick the player // Kick Player after Registration is enabled, kick the player
if (Settings.forceRegKick) { if (Settings.forceRegKick) {
player.kickPlayer(m._("registered")[0]); player.kickPlayer(m.send("registered")[0]);
return; return;
} }

View File

@ -68,7 +68,7 @@ public class Messages extends CustomConfiguration {
this.save(); this.save();
} }
public void _(CommandSender sender, String msg) { public void send(CommandSender sender, String msg) {
String loc = (String) this.get(msg); String loc = (String) this.get(msg);
if (loc == null) { if (loc == null) {
loc = "Error with Translation files; Please contact the admin for verify or update translation"; loc = "Error with Translation files; Please contact the admin for verify or update translation";
@ -79,7 +79,7 @@ public class Messages extends CustomConfiguration {
} }
} }
public String[] _(String msg) { public String[] send(String msg) {
int i = ((String) this.get(msg)).split("&n").length; int i = ((String) this.get(msg)).split("&n").length;
String[] loc = new String[i]; String[] loc = new String[i];
int a; int a;

View File

@ -50,7 +50,7 @@ public class TimeoutTask implements Runnable {
player.setGameMode(gm); player.setGameMode(gm);
ConsoleLogger.info("Set " + player.getName() + " to gamemode: " + gm.name()); ConsoleLogger.info("Set " + player.getName() + " to gamemode: " + gm.name());
} }
player.kickPlayer(m._("timeout")[0]); player.kickPlayer(m.send("timeout")[0]);
break; break;
} }
} }