Fix LowerCase issue

This commit is contained in:
Xephi59
2015-07-23 16:23:25 +02:00
parent a9dcf15759
commit 4c2fad3643
18 changed files with 297 additions and 89 deletions
@@ -100,6 +100,26 @@ public class AsyncronousJoin {
}
final Location spawnLoc = plugin.getSpawnLocation(player);
if (database.isAuthAvailable(name)) {
PlayerAuth auth = database.getAuth(name);
if (!auth.getRealName().equals("Player") && !auth.getRealName().equals(player.getName())) {
final GameMode gM = AuthMePlayerListener.gameMode.get(name);
sched.scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
if (gM != null) {
AuthMePlayerListener.causeByAuthMe.put(name, true);
player.setGameMode(gM);
AuthMePlayerListener.causeByAuthMe.put(name, false);
}
player.kickPlayer("You are not the Owner of this account, please try another name!");
if (Settings.banUnsafeIp)
plugin.getServer().banIP(ip);
}
}, 1);
return;
}
if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) {
sched.scheduleSyncDelayedTask(plugin, new Runnable() {
@@ -50,11 +50,11 @@ public class AsyncronousLogin {
protected boolean needsCaptcha() {
if (Settings.useCaptcha) {
if (!plugin.captcha.containsKey(name)) {
plugin.captcha.put(name, 1);
plugin.captcha.putIfAbsent(name, 1);
} else {
int i = plugin.captcha.get(name) + 1;
plugin.captcha.remove(name);
plugin.captcha.put(name, i);
plugin.captcha.putIfAbsent(name, i);
}
if (plugin.captcha.containsKey(name) && plugin.captcha.get(name) >= Settings.maxLoginTry) {
plugin.cap.put(name, rdm.nextString());
@@ -133,7 +133,7 @@ public class AsyncronousLogin {
return;
}
if (passwordVerified && player.isOnline()) {
PlayerAuth auth = new PlayerAuth(name, hash, getIP(), new Date().getTime(), email);
PlayerAuth auth = new PlayerAuth(name, hash, getIP(), new Date().getTime(), email, realName);
database.updateSession(auth);
if (Settings.useCaptcha) {
@@ -157,7 +157,7 @@ public class AsyncronousLogin {
}
if (!Settings.noConsoleSpam)
ConsoleLogger.info(player.getName() + " logged in!");
ConsoleLogger.info(realName + " logged in!");
// makes player isLoggedin via API
PlayerCache.getInstance().addPlayer(auth);
@@ -178,7 +178,7 @@ public class AsyncronousLogin {
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, syncronousPlayerLogin);
} else if (player.isOnline()) {
if (!Settings.noConsoleSpam)
ConsoleLogger.info(player.getName() + " used the wrong password");
ConsoleLogger.info(realName + " used the wrong password");
if (Settings.isKickOnWrongPasswordEnabled) {
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@@ -51,13 +51,13 @@ public class AsyncronousQuit {
if (PlayerCache.getInstance().isAuthenticated(name) && !player.isDead()) {
if (Settings.isSaveQuitLocationEnabled && database.isAuthAvailable(name)) {
final PlayerAuth auth = new PlayerAuth(name, loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName());
final PlayerAuth auth = new PlayerAuth(name, loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName(), player.getName());
try {
database.updateQuitLoc(auth);
} catch (NullPointerException npe) {
}
}
PlayerAuth auth = new PlayerAuth(name, ip, System.currentTimeMillis());
PlayerAuth auth = new PlayerAuth(name, ip, System.currentTimeMillis(), player.getName());
database.updateSession(auth);
}
@@ -115,7 +115,7 @@ public class AsyncronousRegister {
PlayerAuth auth = null;
try {
final String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, password, name);
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, player.getName());
} catch (NoSuchAlgorithmException e) {
ConsoleLogger.showError(e.getMessage());
m.send(player, "error");
@@ -144,9 +144,9 @@ public class AsyncronousRegister {
return;
}
if (Settings.getMySQLColumnSalt.isEmpty() && !PasswordSecurity.userSalt.containsKey(name)) {
auth = new PlayerAuth(name, hash, getIp(), new Date().getTime(), "your@email.com");
auth = new PlayerAuth(name, hash, getIp(), new Date().getTime(), "your@email.com", player.getName());
} else {
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(), player.getName());
}
if (!database.saveAuth(auth)) {
m.send(player, "error");