From 712f1373c067815950107f69a1a4ac423d61f557 Mon Sep 17 00:00:00 2001 From: OmerBenGera Date: Thu, 29 Oct 2020 13:29:51 +0200 Subject: [PATCH] Fixed issue with parsing infinite chunk loaders --- .../java/com/bgsoftware/wildloaders/loaders/WLoaderData.java | 2 +- src/main/java/com/bgsoftware/wildloaders/utils/TimeUtils.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/bgsoftware/wildloaders/loaders/WLoaderData.java b/src/main/java/com/bgsoftware/wildloaders/loaders/WLoaderData.java index 2f74c01..5683244 100644 --- a/src/main/java/com/bgsoftware/wildloaders/loaders/WLoaderData.java +++ b/src/main/java/com/bgsoftware/wildloaders/loaders/WLoaderData.java @@ -55,7 +55,7 @@ public final class WLoaderData implements LoaderData { ItemMeta itemMeta = itemStack.getItemMeta(); if(itemMeta != null){ - String formattedTime = TimeUtils.formatTime(timeLeft); + String formattedTime = isInfinite() ? "" : TimeUtils.formatTime(timeLeft); if(itemMeta.hasDisplayName()) { itemMeta.setDisplayName(itemMeta.getDisplayName().replace("{}", formattedTime)); diff --git a/src/main/java/com/bgsoftware/wildloaders/utils/TimeUtils.java b/src/main/java/com/bgsoftware/wildloaders/utils/TimeUtils.java index dd1c829..98c419b 100644 --- a/src/main/java/com/bgsoftware/wildloaders/utils/TimeUtils.java +++ b/src/main/java/com/bgsoftware/wildloaders/utils/TimeUtils.java @@ -111,7 +111,7 @@ public final class TimeUtils { .append((time == 1 ? Locale.TIME_PLACEHOLDER_SECOND : Locale.TIME_PLACEHOLDER_SECONDS).getMessage()); } - return stringBuilder.substring(2); + return stringBuilder.length() == 0 ? "" : stringBuilder.substring(2); } }