Skip to content

Commit 544cfca

Browse files
committed
check for postponed games
1 parent 9e605e3 commit 544cfca

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/main/java/pw/chew/mlb/listeners/GameFeedHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ private static void runGame(String gamePk) {
254254
return;
255255
}
256256

257-
if (recentState.isSuspended()) {
257+
if (recentState.isSuspended() || recentState.isPostponed()) {
258258
endGame(gamePk, recentState, "\nUnfortunately, this game has been suspended. It will resume at a later time.");
259259
return;
260260
}

src/main/java/pw/chew/mlb/objects/GameState.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,26 @@ public boolean isCancelled() {
7676
return gameData().getJSONObject("gameData").getJSONObject("status").getString("detailedState").equals("Cancelled");
7777
}
7878

79+
/**
80+
* Check if a game is suspended.
81+
* A game suspension usually means we don't know when or if the game will be resumed.
82+
*
83+
* @return true if the game is suspended, false otherwise
84+
*/
7985
public boolean isSuspended() {
8086
return gameData().getJSONObject("gameData").getJSONObject("status").getString("detailedState").contains("Suspended");
8187
}
8288

89+
/**
90+
* Check if a game is postponed.
91+
* Typically, postponements have a rescheduled date. But, we don't care about that here.
92+
*
93+
* @return true if the game is postponed, false otherwise
94+
*/
95+
public boolean isPostponed() {
96+
return gameData().getJSONObject("gameData").getJSONObject("status").getString("detailedState").contains("Postponed");
97+
}
98+
8399
/**
84100
* Whether a game is final.
85101
* @return true if the game is final, false otherwise

0 commit comments

Comments
 (0)