mirror of
https://github.com/kuroppoi/entralinked.git
synced 2026-09-14 03:35:41 -05:00
Remove unneeded status checks (#91)
Some checks failed
Build / dist (push) Has been cancelled
Some checks failed
Build / dist (push) Has been cancelled
This commit is contained in:
@@ -6,9 +6,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
public record Configuration(
|
||||
String hostName,
|
||||
boolean clearPlayerDreamInfoOnWake,
|
||||
boolean allowOverwritingPlayerDreamInfo,
|
||||
boolean allowPlayerGameVersionMismatch,
|
||||
boolean allowWfcRegistrationThroughLogin) {
|
||||
|
||||
public static final Configuration DEFAULT = new Configuration("local", true, false, false, true);
|
||||
public static final Configuration DEFAULT = new Configuration("local", true, true);
|
||||
}
|
||||
|
||||
@@ -420,11 +420,8 @@ public class PglHandler implements HttpHandler {
|
||||
LEOutputStream outputStream = new LEOutputStream(ctx.outputStream());
|
||||
Player player = playerManager.getPlayer(request.gameSyncId());
|
||||
|
||||
// Check if the player exists, has no Pokémon tucked in already and uses the same game version
|
||||
if(player == null
|
||||
|| (!configuration.allowOverwritingPlayerDreamInfo() && player.getStatus() != PlayerStatus.AWAKE)
|
||||
|| (!configuration.allowPlayerGameVersionMismatch() && player.getGameVersion() != null
|
||||
&& request.gameVersion() != player.getGameVersion())) {
|
||||
// Check if the player exists
|
||||
if(player == null) {
|
||||
// Skip everything
|
||||
ServletInputStream inputStream = ctx.req().getInputStream();
|
||||
|
||||
@@ -439,6 +436,18 @@ public class PglHandler implements HttpHandler {
|
||||
|
||||
logger.info("Player {} is uploading save data", player.getGameSyncId());
|
||||
|
||||
// Warn if player's current status is unexpected
|
||||
if(player.getStatus() != PlayerStatus.AWAKE)
|
||||
{
|
||||
logger.warn("Player {} is not AWAKE -- existing dream information will be overwritten!", player.getGameSyncId());
|
||||
}
|
||||
|
||||
// Warn if player's game version changed
|
||||
if(player.getGameVersion() != null && request.gameVersion() != player.getGameVersion())
|
||||
{
|
||||
logger.warn("Player {}'s game version changed from {} to {}", player.getGameSyncId(), player.getGameVersion(), request.gameVersion());
|
||||
}
|
||||
|
||||
// Try to store save data
|
||||
if(!playerManager.storePlayerGameSaveFile(player, ctx.bodyInputStream())) {
|
||||
writeStatusCode(outputStream, 4); // Game save data IO error
|
||||
|
||||
Reference in New Issue
Block a user