mirror of
https://e.coding.net/circlecloud/AuthMe.git
synced 2024-12-22 06:48:55 +00:00
修复登录同名问题...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
aa5f01c3ed
commit
16be94d926
@ -23,7 +23,7 @@ public class RegisterCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command cmnd, final String label, final String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("Player Only! Use 'authme register <playername> <password>' instead");
|
||||
sender.sendMessage("控制台请使用 'authme register <playername> <password>' 注册玩家");
|
||||
return true;
|
||||
}
|
||||
final Player player = (Player) sender;
|
||||
|
@ -411,11 +411,10 @@ public class AuthMePlayerListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPreLogin(final AsyncPlayerPreLoginEvent event) {
|
||||
final String name = event.getName().toLowerCase();
|
||||
final Player player = Bukkit.getServer().getPlayer(name);
|
||||
final Player player = Bukkit.getServer().getPlayerExact(name);
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if forceSingleSession is set to true, so kick player that has
|
||||
// joined with same nick of online player
|
||||
if (Settings.isForceSingleSessionEnabled && plugin.dataManager.isOnline(player, name)) {
|
||||
|
@ -25,25 +25,22 @@ public class Management {
|
||||
public AuthMe plugin;
|
||||
public PluginManager pm;
|
||||
|
||||
public Management(AuthMe plugin) {
|
||||
public Management(final AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.pm = plugin.getServer().getPluginManager();
|
||||
}
|
||||
|
||||
public void performJoin(final Player player) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousJoin(player, plugin, plugin.database).process();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void performLogin(final Player player, final String password, final boolean forceLogin) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousLogin(player, password, forceLogin, plugin, plugin.database).process();
|
||||
@ -53,7 +50,6 @@ public class Management {
|
||||
|
||||
public void performLogout(final Player player) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousLogout(player, plugin, plugin.database).process();
|
||||
@ -63,7 +59,6 @@ public class Management {
|
||||
|
||||
public void performQuit(final Player player, final boolean isKick) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousQuit(player, plugin, plugin.database, isKick).process();
|
||||
@ -74,7 +69,6 @@ public class Management {
|
||||
|
||||
public void performRegister(final Player player, final String password, final String email) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousRegister(player, password, email, plugin, plugin.database).process();
|
||||
|
@ -28,7 +28,7 @@ public class AsyncronousRegister {
|
||||
public AsyncronousRegister(final Player player, final String password, final String email, final AuthMe plugin, final DataSource data) {
|
||||
this.player = player;
|
||||
this.password = password;
|
||||
name = player.getName().toLowerCase();
|
||||
this.name = player.getName().toLowerCase();
|
||||
this.email = email;
|
||||
this.plugin = plugin;
|
||||
this.database = data;
|
||||
@ -120,44 +120,31 @@ public class AsyncronousRegister {
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
m.send(player, "logged_in");
|
||||
allowRegister = false;
|
||||
}
|
||||
|
||||
else if (!Settings.isRegistrationEnabled) {
|
||||
} else if (!Settings.isRegistrationEnabled) {
|
||||
m.send(player, "reg_disabled");
|
||||
allowRegister = false;
|
||||
}
|
||||
|
||||
else if (lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select")
|
||||
} 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) {
|
||||
} else if (password.length() < Settings.getPasswordMinLen || password.length() > Settings.passwordMaxLength) {
|
||||
m.send(player, "pass_len");
|
||||
allowRegister = false;
|
||||
}
|
||||
|
||||
else if (!Settings.unsafePasswords.isEmpty() && Settings.unsafePasswords.contains(password.toLowerCase())) {
|
||||
} else if (!Settings.unsafePasswords.isEmpty() && Settings.unsafePasswords.contains(password.toLowerCase())) {
|
||||
m.send(player, "password_error_unsafe");
|
||||
allowRegister = false;
|
||||
} else if (database.isAuthAvailable(name)) {
|
||||
m.send(player, "user_regged");
|
||||
allowRegister = false;
|
||||
}
|
||||
|
||||
else if (Settings.getmaxRegPerIp > 0) {
|
||||
} else 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")) {
|
||||
m.send(player, "max_reg");
|
||||
allowRegister = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user