Skip to content

Commit

Permalink
fix: add MMM d, yyyy, HH:mm:ss a timestamp heal support
Browse files Browse the repository at this point in the history
  • Loading branch information
titivermeesch committed Jun 22, 2024
1 parent 2d4198b commit a6fb140
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ java {
}

group = 'me.playbosswar.com'
version = '8.7.0'
version = '8.7.1'
description = 'CommandTimer'

repositories {
Expand Down Expand Up @@ -61,7 +61,7 @@ publishing {
maven(MavenPublication) {
groupId = 'me.playbosswar.com'
artifactId = 'commandtimer'
version = '8.7.0'
version = '8.7.1'

from components.java
}
Expand Down
4 changes: 2 additions & 2 deletions java8-build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ java {
}

group = 'me.playbosswar.com'
version = '8.7.0'
version = '8.7.1'
description = 'CommandTimer'

repositories {
Expand Down Expand Up @@ -69,7 +69,7 @@ publishing {
maven(MavenPublication) {
groupId = 'me.playbosswar.com'
artifactId = 'commandtimer'
version = '8.7.0'
version = '8.7.1'

from components.java
}
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/me/playbosswar/com/utils/gson/GsonDate.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@ public Date deserialize(JsonElement jsonElement, Type type,
SimpleDateFormat formatter = new SimpleDateFormat(FORMAT);
try {
return formatter.parse(jsonElement.getAsString());
} catch(ParseException e) {
} catch(ParseException ex1) {
// Check if maybe it's in the old format
try {
SimpleDateFormat oldFormatter = new SimpleDateFormat("MMM d, yyyy, H:mm:ss a");
return oldFormatter.parse(jsonElement.getAsString());
} catch(ParseException ex) {
throw new JsonParseException(e);
} catch(ParseException ex2) {
try {
SimpleDateFormat oldFormatter = new SimpleDateFormat("MMM d, yyyy, HH:mm:ss a");
return oldFormatter.parse(jsonElement.getAsString());
} catch(ParseException ex3) {
throw new JsonParseException(ex3);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
main: me.playbosswar.com.CommandTimerPlugin
name: "CommandTimer"
version: "8.7.0"
version: "8.7.1"
description: "Schedule commands like you want"
author: PlayBossWar
api-version: 1.13
Expand Down

0 comments on commit a6fb140

Please sign in to comment.