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
|
@Override
|
||||||
public boolean onCommand(final CommandSender sender, final Command cmnd, final String label, final String[] args) {
|
public boolean onCommand(final CommandSender sender, final Command cmnd, final String label, final String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage("Player Only! Use 'authme register <playername> <password>' instead");
|
sender.sendMessage("控制台请使用 'authme register <playername> <password>' 注册玩家");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final Player player = (Player) sender;
|
final Player player = (Player) sender;
|
||||||
|
@ -411,11 +411,10 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPreLogin(final AsyncPlayerPreLoginEvent event) {
|
public void onPreLogin(final AsyncPlayerPreLoginEvent event) {
|
||||||
final String name = event.getName().toLowerCase();
|
final String name = event.getName().toLowerCase();
|
||||||
final Player player = Bukkit.getServer().getPlayer(name);
|
final Player player = Bukkit.getServer().getPlayerExact(name);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if forceSingleSession is set to true, so kick player that has
|
// Check if forceSingleSession is set to true, so kick player that has
|
||||||
// joined with same nick of online player
|
// joined with same nick of online player
|
||||||
if (Settings.isForceSingleSessionEnabled && plugin.dataManager.isOnline(player, name)) {
|
if (Settings.isForceSingleSessionEnabled && plugin.dataManager.isOnline(player, name)) {
|
||||||
|
@ -25,25 +25,22 @@ public class Management {
|
|||||||
public AuthMe plugin;
|
public AuthMe plugin;
|
||||||
public PluginManager pm;
|
public PluginManager pm;
|
||||||
|
|
||||||
public Management(AuthMe plugin) {
|
public Management(final AuthMe plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.pm = plugin.getServer().getPluginManager();
|
this.pm = plugin.getServer().getPluginManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void performJoin(final Player player) {
|
public void performJoin(final Player player) {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
new AsyncronousJoin(player, plugin, plugin.database).process();
|
new AsyncronousJoin(player, plugin, plugin.database).process();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void performLogin(final Player player, final String password, final boolean forceLogin) {
|
public void performLogin(final Player player, final String password, final boolean forceLogin) {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
new AsyncronousLogin(player, password, forceLogin, plugin, plugin.database).process();
|
new AsyncronousLogin(player, password, forceLogin, plugin, plugin.database).process();
|
||||||
@ -53,7 +50,6 @@ public class Management {
|
|||||||
|
|
||||||
public void performLogout(final Player player) {
|
public void performLogout(final Player player) {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
new AsyncronousLogout(player, plugin, plugin.database).process();
|
new AsyncronousLogout(player, plugin, plugin.database).process();
|
||||||
@ -63,7 +59,6 @@ public class Management {
|
|||||||
|
|
||||||
public void performQuit(final Player player, final boolean isKick) {
|
public void performQuit(final Player player, final boolean isKick) {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
new AsyncronousQuit(player, plugin, plugin.database, isKick).process();
|
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) {
|
public void performRegister(final Player player, final String password, final String email) {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
new AsyncronousRegister(player, password, email, plugin, plugin.database).process();
|
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) {
|
public AsyncronousRegister(final Player player, final String password, final String email, final AuthMe plugin, final DataSource data) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
name = player.getName().toLowerCase();
|
this.name = player.getName().toLowerCase();
|
||||||
this.email = email;
|
this.email = email;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.database = data;
|
this.database = data;
|
||||||
@ -120,44 +120,31 @@ public class AsyncronousRegister {
|
|||||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||||
m.send(player, "logged_in");
|
m.send(player, "logged_in");
|
||||||
allowRegister = false;
|
allowRegister = false;
|
||||||
}
|
} else if (!Settings.isRegistrationEnabled) {
|
||||||
|
|
||||||
else if (!Settings.isRegistrationEnabled) {
|
|
||||||
m.send(player, "reg_disabled");
|
m.send(player, "reg_disabled");
|
||||||
allowRegister = false;
|
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)) {
|
|| lowpass.contains(";") || lowpass.contains("null") || !lowpass.matches(Settings.getPassRegex)) {
|
||||||
m.send(player, "password_error");
|
m.send(player, "password_error");
|
||||||
allowRegister = false;
|
allowRegister = false;
|
||||||
}
|
} else if (lowpass.equalsIgnoreCase(player.getName())) {
|
||||||
|
|
||||||
else if (lowpass.equalsIgnoreCase(player.getName())) {
|
|
||||||
m.send(player, "password_error_nick");
|
m.send(player, "password_error_nick");
|
||||||
allowRegister = false;
|
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");
|
m.send(player, "pass_len");
|
||||||
allowRegister = false;
|
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");
|
m.send(player, "password_error_unsafe");
|
||||||
allowRegister = false;
|
allowRegister = false;
|
||||||
} else if (database.isAuthAvailable(name)) {
|
} else if (database.isAuthAvailable(name)) {
|
||||||
m.send(player, "user_regged");
|
m.send(player, "user_regged");
|
||||||
allowRegister = false;
|
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")
|
if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByIp(getIp()).size() >= Settings.getmaxRegPerIp && !getIp().equalsIgnoreCase("127.0.0.1")
|
||||||
&& !getIp().equalsIgnoreCase("localhost")) {
|
&& !getIp().equalsIgnoreCase("localhost")) {
|
||||||
m.send(player, "max_reg");
|
m.send(player, "max_reg");
|
||||||
allowRegister = false;
|
allowRegister = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user