mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-29 18:27:36 +02:00
Fix race condition when waiting for bukkit message while
bungee redirects player
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.games647</groupId>
|
||||
<artifactId>fastlogin</artifactId>
|
||||
<version>1.7.1</version>
|
||||
<version>1.8</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.games647</groupId>
|
||||
<artifactId>fastlogin</artifactId>
|
||||
<version>1.7.1</version>
|
||||
<version>1.8</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -6,6 +6,7 @@ import com.github.games647.fastlogin.core.PlayerProfile;
|
||||
public class BungeeLoginSession extends LoginSession {
|
||||
|
||||
private boolean alreadySaved;
|
||||
private boolean alreadyLogged;
|
||||
|
||||
public BungeeLoginSession(String username, boolean registered, PlayerProfile profile) {
|
||||
super(username, registered, profile);
|
||||
@ -22,4 +23,12 @@ public class BungeeLoginSession extends LoginSession {
|
||||
public void setAlreadySaved(boolean alreadySaved) {
|
||||
this.alreadySaved = alreadySaved;
|
||||
}
|
||||
|
||||
public boolean isAlreadyLogged() {
|
||||
return alreadyLogged;
|
||||
}
|
||||
|
||||
public void setAlreadyLogged(boolean alreadyLogged) {
|
||||
this.alreadyLogged = alreadyLogged;
|
||||
}
|
||||
}
|
||||
|
@ -48,8 +48,10 @@ public class ForceLoginTask implements Runnable {
|
||||
//save will happen on success message from bukkit
|
||||
sendBukkitLoginNotification(autoRegister);
|
||||
} else if (session.needsRegistration()) {
|
||||
session.setAlreadyLogged(true);
|
||||
forceRegister(session, authPlugin);
|
||||
} else if (authPlugin.forceLogin(player)) {
|
||||
session.setAlreadyLogged(true);
|
||||
forceLogin(session, authPlugin);
|
||||
}
|
||||
} else {
|
||||
@ -66,8 +68,10 @@ public class ForceLoginTask implements Runnable {
|
||||
}
|
||||
|
||||
private void forceRegister(BungeeLoginSession session, BungeeAuthPlugin authPlugin) {
|
||||
session.setAlreadyLogged(true);
|
||||
|
||||
String password = plugin.generateStringPassword();
|
||||
if (session.isAlreadySaved() || authPlugin.forceRegister(player, password)) {
|
||||
if (session.isAlreadyLogged()|| authPlugin.forceRegister(player, password)) {
|
||||
//save will happen on success message from bukkit
|
||||
sendBukkitLoginNotification(true);
|
||||
String message = plugin.getCore().getMessage("auto-register");
|
||||
@ -79,7 +83,9 @@ public class ForceLoginTask implements Runnable {
|
||||
}
|
||||
|
||||
private void forceLogin(BungeeLoginSession session, BungeeAuthPlugin authPlugin) {
|
||||
if (session.isAlreadySaved() || authPlugin.forceLogin(player)) {
|
||||
session.setAlreadyLogged(true);
|
||||
|
||||
if (session.isAlreadyLogged() || authPlugin.forceLogin(player)) {
|
||||
//save will happen on success message from bukkit
|
||||
sendBukkitLoginNotification(false);
|
||||
String message = plugin.getCore().getMessage("auto-login");
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.games647</groupId>
|
||||
<artifactId>fastlogin</artifactId>
|
||||
<version>1.7.1</version>
|
||||
<version>1.8</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
2
pom.xml
2
pom.xml
@ -8,7 +8,7 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>FastLogin</name>
|
||||
<version>1.7.1</version>
|
||||
<version>1.8</version>
|
||||
<inceptionYear>2015</inceptionYear>
|
||||
<url>https://www.spigotmc.org/resources/fastlogin.14153/</url>
|
||||
<description>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.games647</groupId>
|
||||
<artifactId>fastlogin</artifactId>
|
||||
<version>1.7.1</version>
|
||||
<version>1.8</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
Reference in New Issue
Block a user