Move from Join to Login

This commit is contained in:
Xephi59 2015-08-10 23:15:29 +02:00
parent 7fe0fe5c8e
commit 5c059bdd43
2 changed files with 12 additions and 22 deletions

View File

@ -44,6 +44,7 @@ import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.cache.limbo.LimboPlayer;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.plugin.manager.CombatTagComunicator; import fr.xephi.authme.plugin.manager.CombatTagComunicator;
import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
@ -465,6 +466,17 @@ public class AuthMePlayerListener implements Listener {
return; return;
} }
if (plugin.database.getType() != DataSource.DataSourceType.FILE) {
PlayerAuth auth = plugin.database.getAuth(name);
if (auth.getRealName() != null && !auth.getRealName().isEmpty() && !auth.getRealName().equalsIgnoreCase("Player") && !auth.getRealName().equals(player.getName())) {
event.setKickMessage(m.send("same_nick")[0]);
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
if (Settings.banUnsafeIp)
plugin.getServer().banIP(player.getAddress().getAddress().getHostAddress());
return;
}
}
int min = Settings.getMinNickLength; int min = Settings.getMinNickLength;
int max = Settings.getMaxNickLength; int max = Settings.getMaxNickLength;
String regex = Settings.getNickRegex; String regex = Settings.getNickRegex;

View File

@ -100,28 +100,6 @@ public class AsyncronousJoin {
} }
final Location spawnLoc = plugin.getSpawnLocation(player); final Location spawnLoc = plugin.getSpawnLocation(player);
if (database.isAuthAvailable(name)) { if (database.isAuthAvailable(name)) {
if (database.getType() != DataSource.DataSourceType.FILE) {
PlayerAuth auth = database.getAuth(name);
if (auth.getRealName() != null && !auth.getRealName().isEmpty() && !auth.getRealName().equalsIgnoreCase("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) { if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) {
sched.scheduleSyncDelayedTask(plugin, new Runnable() { sched.scheduleSyncDelayedTask(plugin, new Runnable() {