From 64004e426767b21efb5d554b43edd71aea0ed26a Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Tue, 18 Oct 2022 13:09:38 +0200 Subject: [PATCH] Fixes some problems in the calculation of the remaining cool-down time --- .../java/net/knarcraft/blacksmith/trait/BlacksmithTrait.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/knarcraft/blacksmith/trait/BlacksmithTrait.java b/src/main/java/net/knarcraft/blacksmith/trait/BlacksmithTrait.java index b7d28ca..373105a 100644 --- a/src/main/java/net/knarcraft/blacksmith/trait/BlacksmithTrait.java +++ b/src/main/java/net/knarcraft/blacksmith/trait/BlacksmithTrait.java @@ -122,7 +122,7 @@ public class BlacksmithTrait extends Trait { if (coolDowns.get(playerId) != null) { Calendar calendar = Calendar.getInstance(); if (!calendar.after(coolDowns.get(playerId))) { - int secondDifference = (int) ((calendar.getTimeInMillis() - coolDowns.get(playerId).getTimeInMillis()) * 1000); + int secondDifference = (int) (coolDowns.get(playerId).getTimeInMillis() - calendar.getTimeInMillis()) / 1000; boolean exactTime = BlacksmithPlugin.getInstance().getSettings().getShowExactTime(); sendNPCMessage(this.npc, player, replacePlaceholder(config.getCoolDownUnexpiredMessage(), "{time}", TimeFormatter.formatTime(exactTime, secondDifference)));