mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-30 02:37:34 +02:00
Fix update username in FastLogin database after nameChange (Fixes #67)
This commit is contained in:
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
* Added second attempt login -> cracked login
|
* Added second attempt login -> cracked login
|
||||||
* Fix ProtocolSupport autoRegister
|
* Fix ProtocolSupport autoRegister
|
||||||
|
* Fix update username in FastLogin database after nameChange
|
||||||
|
|
||||||
######1.8
|
######1.8
|
||||||
|
|
||||||
|
@ -78,6 +78,10 @@ public class NameCheckTask implements Runnable {
|
|||||||
PlayerProfile uuidProfile = plugin.getCore().getStorage().loadProfile(premiumUUID);
|
PlayerProfile uuidProfile = plugin.getCore().getStorage().loadProfile(premiumUUID);
|
||||||
if (uuidProfile != null) {
|
if (uuidProfile != null) {
|
||||||
plugin.getLogger().log(Level.FINER, "Player {0} changed it's username", premiumUUID);
|
plugin.getLogger().log(Level.FINER, "Player {0} changed it's username", premiumUUID);
|
||||||
|
|
||||||
|
//update the username to the new one in the database
|
||||||
|
uuidProfile.setPlayerName(username);
|
||||||
|
|
||||||
enablePremiumLogin(uuidProfile, false);
|
enablePremiumLogin(uuidProfile, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,10 @@ public class ProtocolSupportListener implements Listener {
|
|||||||
PlayerProfile uuidProfile = plugin.getCore().getStorage().loadProfile(premiumUUID);
|
PlayerProfile uuidProfile = plugin.getCore().getStorage().loadProfile(premiumUUID);
|
||||||
if (uuidProfile != null) {
|
if (uuidProfile != null) {
|
||||||
plugin.getLogger().log(Level.FINER, "Player {0} changed it's username", premiumUUID);
|
plugin.getLogger().log(Level.FINER, "Player {0} changed it's username", premiumUUID);
|
||||||
|
|
||||||
|
//update the username to the new one in the database
|
||||||
|
uuidProfile.setPlayerName(username);
|
||||||
|
|
||||||
startPremiumSession(username, loginStartEvent, false, uuidProfile);
|
startPremiumSession(username, loginStartEvent, false, uuidProfile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,10 @@ public class AsyncPremiumCheck implements Runnable {
|
|||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
//uuid exists in the database
|
//uuid exists in the database
|
||||||
plugin.getLogger().log(Level.FINER, "Player {0} changed it's username", premiumUUID);
|
plugin.getLogger().log(Level.FINER, "Player {0} changed it's username", premiumUUID);
|
||||||
|
|
||||||
|
//update the username to the new one in the database
|
||||||
|
profile.setPlayerName(username);
|
||||||
|
|
||||||
requestPremiumLogin(connection, profile, username, false);
|
requestPremiumLogin(connection, profile, username, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class PlayerProfile {
|
public class PlayerProfile {
|
||||||
|
|
||||||
private final String playerName;
|
private String playerName;
|
||||||
|
|
||||||
private long userId;
|
private long userId;
|
||||||
|
|
||||||
@ -32,10 +32,14 @@ public class PlayerProfile {
|
|||||||
this.lastIp = lastIp;
|
this.lastIp = lastIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPlayerName() {
|
public synchronized String getPlayerName() {
|
||||||
return playerName;
|
return playerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void setPlayerName(String playerName) {
|
||||||
|
this.playerName = playerName;
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized long getUserId() {
|
public synchronized long getUserId() {
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user