aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCow <cow@volloeko.de>2020-09-16 00:19:10 +0200
committerCow <cow@volloeko.de>2020-09-16 00:19:10 +0200
commit705299e37d27d421156a09213e0654d0ab4fb01c (patch)
tree9815dfeea27e0f2464f0affcb03562e75a5afa48 /src
parentb064b892f4e4543db8e42b36f48c9b29bc0f5d8e (diff)
downloadCowlection-705299e37d27d421156a09213e0654d0ab4fb01c.tar.gz
Cowlection-705299e37d27d421156a09213e0654d0ab4fb01c.tar.bz2
Cowlection-705299e37d27d421156a09213e0654d0ab4fb01c.zip
Fixed crash when entering a dungeon
bumped version to 0.10.2
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/cowtipper/cowlection/handler/DungeonCache.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/handler/DungeonCache.java b/src/main/java/de/cowtipper/cowlection/handler/DungeonCache.java
index c1bc33a..07a1fe4 100644
--- a/src/main/java/de/cowtipper/cowlection/handler/DungeonCache.java
+++ b/src/main/java/de/cowtipper/cowlection/handler/DungeonCache.java
@@ -92,11 +92,15 @@ public class DungeonCache {
if (scorePlayerTeam != null) {
String lineWithoutFormatting = EnumChatFormatting.getTextWithoutFormattingCodes(scorePlayerTeam.getColorPrefix() + scorePlayerTeam.getColorSuffix());
- if (lineWithoutFormatting.startsWith("Time Elapsed:")) {
- // dungeon timer: 05m22s
- String timeString = lineWithoutFormatting.substring(lineWithoutFormatting.lastIndexOf(' ') + 1);
+ String timeElapsed = "Time Elapsed: ";
+ if (lineWithoutFormatting.startsWith(timeElapsed)) {
+ // dungeon timer: 05m 22s
+ String timeString = lineWithoutFormatting.substring(timeElapsed.length());
try {
- elapsedMinutes = (Integer.parseInt(timeString.substring(0, timeString.indexOf('m'))));
+ int indexOfMinute = timeString.indexOf('m');
+ if (indexOfMinute > -1) {
+ elapsedMinutes = (Integer.parseInt(timeString.substring(0, indexOfMinute)));
+ }
} catch (NumberFormatException ex) {
// couldn't parse dungeon time from scoreboard
ex.printStackTrace();