Use a better method name for StoredProfile.isPremium

This commit is contained in:
games647
2024-05-10 10:09:12 +02:00
parent 204d25a739
commit 756b777056
8 changed files with 41 additions and 18 deletions
@@ -81,7 +81,7 @@ public abstract class ForceLoginManagement<P extends C, C, L extends LoginSessio
//update only on success to prevent corrupt data
if (playerProfile != null) {
playerProfile.setId(session.getUuid());
playerProfile.setPremium(true);
playerProfile.setOnlinemodePreferred(true);
storage.save(playerProfile);
}
@@ -91,7 +91,7 @@ public abstract class ForceLoginManagement<P extends C, C, L extends LoginSessio
} else if (playerProfile != null) {
//cracked player
playerProfile.setId(null);
playerProfile.setPremium(false);
playerProfile.setOnlinemodePreferred(false);
storage.save(playerProfile);
}
} catch (Exception ex) {
@@ -97,19 +97,42 @@ public class StoredProfile extends Profile {
this.id = uniqueId;
}
/**
* @return whether the online mode should be enabled for this player
* @deprecated {@link #isOnlinemodePreferred()} is recommended, because the name represents more its
* meaning
*/
@Deprecated
public synchronized boolean isPremium() {
return premium;
}
/**
* Return the online mode preference for this player.
* <p>
* <b>
* Note: {@code false} doesn't represent that the player is offline. It could also mean that the player is premium,
* but didn't activated the premium login mode yet.
* </b>
*
* @return whether the online mode should be enabled for this player
*/
public synchronized boolean isOnlinemodePreferred() {
return premium;
}
/**
* @deprecated {@link #setOnlinemodePreferred(boolean)} is recommended, because of the better method name
*/
@Deprecated
public synchronized void setPremium(boolean premium) {
this.premium = premium;
}
public synchronized void setOnlinemodePreferred(boolean premium) {
this.premium = premium;
}
public synchronized FloodgateState getFloodgate() {
return floodgate;
}
@@ -165,11 +188,11 @@ public class StoredProfile extends Profile {
@Override
public synchronized String toString() {
return this.getClass().getSimpleName() + '{'
+ "rowId=" + rowId
+ ", premium=" + premium
+ ", floodgate=" + floodgate
+ ", lastIp='" + lastIp + '\''
+ ", lastLogin=" + lastLogin
+ "} " + super.toString();
+ "rowId=" + rowId
+ ", premium=" + premium
+ ", floodgate=" + floodgate
+ ", lastIp='" + lastIp + '\''
+ ", lastLogin=" + lastLogin
+ "} " + super.toString();
}
}