mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-30 02:37:34 +02:00
Fixed autoRegister support for LoginSecurity
This commit is contained in:
23
README.md
23
README.md
@ -33,17 +33,20 @@ So they don't need to enter passwords. This is also called auto login (auto-logi
|
|||||||
* Tested Bukkit/[Spigot](https://www.spigotmc.org) 1.9 (could also work with other versions)
|
* Tested Bukkit/[Spigot](https://www.spigotmc.org) 1.9 (could also work with other versions)
|
||||||
* Java 7+
|
* Java 7+
|
||||||
* Run Spigot and/or BungeeCord in offline mode (see server.properties or config.yml)
|
* Run Spigot and/or BungeeCord in offline mode (see server.properties or config.yml)
|
||||||
* An auth plugin. Supported Plugins:
|
* An auth plugin. Supported Plugins
|
||||||
* Bukkit:
|
|
||||||
* [AuthMe](http://dev.bukkit.org/bukkit-plugins/authme-reloaded/)
|
|
||||||
* [xAuth](http://dev.bukkit.org/bukkit-plugins/xauth/)
|
|
||||||
* [CrazyLogin](http://dev.bukkit.org/bukkit-plugins/crazylogin/)
|
|
||||||
* [LoginSecurity](http://dev.bukkit.org/bukkit-plugins/loginsecurity/)
|
|
||||||
* [RoyalAuth](http://dev.bukkit.org/bukkit-plugins/royalauth/)
|
|
||||||
* [UltraAuth](http://dev.bukkit.org/bukkit-plugins/ultraauth-aa/)
|
|
||||||
|
|
||||||
* BungeeCord:
|
#### Bukkit
|
||||||
* [BungeeAuth](https://www.spigotmc.org/resources/bungeeauth.493/)
|
|
||||||
|
* [AuthMe](http://dev.bukkit.org/bukkit-plugins/authme-reloaded/)
|
||||||
|
* [xAuth](http://dev.bukkit.org/bukkit-plugins/xauth/)
|
||||||
|
* [CrazyLogin](http://dev.bukkit.org/bukkit-plugins/crazylogin/)
|
||||||
|
* [LoginSecurity](http://dev.bukkit.org/bukkit-plugins/loginsecurity/)
|
||||||
|
* [RoyalAuth](http://dev.bukkit.org/bukkit-plugins/royalauth/)
|
||||||
|
* [UltraAuth](http://dev.bukkit.org/bukkit-plugins/ultraauth-aa/)
|
||||||
|
|
||||||
|
#### BungeeCord
|
||||||
|
|
||||||
|
* [BungeeAuth](https://www.spigotmc.org/resources/bungeeauth.493/)
|
||||||
|
|
||||||
###Downloads
|
###Downloads
|
||||||
|
|
||||||
|
@ -12,11 +12,10 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Github: https://github.com/lenis0012/LoginSecurity-2
|
* Github: https://github.com/lenis0012/LoginSecurity-2 Project page:
|
||||||
* Project page:
|
|
||||||
*
|
*
|
||||||
* Bukkit: http://dev.bukkit.org/bukkit-plugins/loginsecurity/
|
* Bukkit: http://dev.bukkit.org/bukkit-plugins/loginsecurity/ Spigot:
|
||||||
* Spigot: https://www.spigotmc.org/resources/loginsecurity.19362/
|
* https://www.spigotmc.org/resources/loginsecurity.19362/
|
||||||
*
|
*
|
||||||
* on join:
|
* on join:
|
||||||
* https://github.com/lenis0012/LoginSecurity-2/blob/master/src/main/java/com/lenis0012/bukkit/ls/LoginSecurity.java#L282
|
* https://github.com/lenis0012/LoginSecurity-2/blob/master/src/main/java/com/lenis0012/bukkit/ls/LoginSecurity.java#L282
|
||||||
@ -45,14 +44,14 @@ public class LoginSecurityHook implements BukkitAuthPlugin {
|
|||||||
DataManager dataManager = securityPlugin.data;
|
DataManager dataManager = securityPlugin.data;
|
||||||
|
|
||||||
//https://github.com/lenis0012/LoginSecurity-2/blob/master/src/main/java/com/lenis0012/bukkit/ls/LoginSecurity.java#L283
|
//https://github.com/lenis0012/LoginSecurity-2/blob/master/src/main/java/com/lenis0012/bukkit/ls/LoginSecurity.java#L283
|
||||||
UUID offlineUuid = UUID.nameUUIDFromBytes(playerName.getBytes(Charsets.UTF_8));
|
UUID offlineUuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + playerName).getBytes(Charsets.UTF_8));
|
||||||
return dataManager.isRegistered(offlineUuid.toString().replace("-", ""));
|
return dataManager.isRegistered(offlineUuid.toString().replace("-", ""));
|
||||||
//check for loginsecurity sessions in order to prevent a sql query?
|
//check for loginsecurity sessions in order to prevent a sql query?
|
||||||
//sesUse && thread.getSession().containsKey(uuid) && checkLastIp(player)) {
|
//sesUse && thread.getSession().containsKey(uuid) && checkLastIp(player)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void forceRegister(Player player, final String password) {
|
public void forceRegister(final Player player, final String password) {
|
||||||
final LoginSecurity securityPlugin = LoginSecurity.instance;
|
final LoginSecurity securityPlugin = LoginSecurity.instance;
|
||||||
final DataManager dataManager = securityPlugin.data;
|
final DataManager dataManager = securityPlugin.data;
|
||||||
|
|
||||||
@ -65,10 +64,15 @@ public class LoginSecurityHook implements BukkitAuthPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
dataManager.register(uuidString, password, securityPlugin.hasher.getTypeId(), ipAddress.toString());
|
dataManager.register(uuidString, password, securityPlugin.hasher.getTypeId(), ipAddress.toString());
|
||||||
|
//run forcelogin only if it was successfull
|
||||||
|
Bukkit.getScheduler().runTask(securityPlugin, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
//notify the plugin that this player can be logged in
|
||||||
|
forceLogin(player);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//notify the plugin that this player can be logged in
|
|
||||||
forceLogin(player);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user