Fix some exception/errors

This commit is contained in:
Xephi 2014-09-14 23:18:05 +02:00
parent 7e16be7f9e
commit 1fc6cdd40b
2 changed files with 21 additions and 8 deletions

View File

@ -171,7 +171,7 @@ public class FlatFileThread extends Thread implements DataSource {
String line = "";
while ((line = br.readLine()) != null) {
String[] args = line.split(":");
if (args[0].equals(auth.getNickname())) {
if (args[0].equalsIgnoreCase(auth.getNickname())) {
switch (args.length) {
case 4: {
newAuth = new PlayerAuth(args[0], args[1], auth.getIp(), auth.getLastLogin(), 0, 0, 0, "world", "your@email.com");
@ -228,7 +228,7 @@ public class FlatFileThread extends Thread implements DataSource {
String line = "";
while ((line = br.readLine()) != null) {
String[] args = line.split(":");
if (args[0].equals(auth.getNickname())) {
if (args[0].equalsIgnoreCase(auth.getNickname())) {
newAuth = new PlayerAuth(args[0], args[1], args[2], Long.parseLong(args[3]), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ(), auth.getWorld(), auth.getEmail());
break;
}

View File

@ -264,7 +264,7 @@ public class AuthMePlayerListener implements Listener {
}
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerEarlyChat(AsyncPlayerChatEvent event) {
public void onPlayerEarlyChat(final AsyncPlayerChatEvent event) {
if (event.isCancelled() || event.getPlayer() == null)
return;
@ -275,11 +275,24 @@ public class AuthMePlayerListener implements Listener {
return;
if (PlayerCache.getInstance().isAuthenticated(name)) {
if (!Settings.isChatAllowed)
for (Player p : event.getRecipients()) {
if (!PlayerCache.getInstance().isAuthenticated(p.getName()))
event.getRecipients().remove(p);
}
if (!event.isAsynchronous()) {
if (!Settings.isChatAllowed)
for (Player p : event.getRecipients()) {
if (!PlayerCache.getInstance().isAuthenticated(p.getName()))
event.getRecipients().remove(p);
}
} else {
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
@Override
public void run() {
if (!Settings.isChatAllowed)
for (Player p : event.getRecipients()) {
if (!PlayerCache.getInstance().isAuthenticated(p.getName()))
event.getRecipients().remove(p);
}
}
});
}
return;
}