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