diff options
author | Ascynx <78341107+Ascynx@users.noreply.github.com> | 2022-10-19 18:40:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-19 18:40:59 +0200 |
commit | 537d5e5fa1ae41e0c3bbe43d745a1b683e078a87 (patch) | |
tree | 85d0221dbf15583c4e45718dc695bb6d659463dc /src/main/java/io | |
parent | 9a5cca0eaba26c40c9e2e88148bda2be161e1d70 (diff) | |
download | NotEnoughUpdates-537d5e5fa1ae41e0c3bbe43d745a1b683e078a87.tar.gz NotEnoughUpdates-537d5e5fa1ae41e0c3bbe43d745a1b683e078a87.tar.bz2 NotEnoughUpdates-537d5e5fa1ae41e0c3bbe43d745a1b683e078a87.zip |
Will now actually set up the pickaxe cooldown on first world joined (#355)
Diffstat (limited to 'src/main/java/io')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java | 11 | ||||
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java | 6 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java index f2b13abc..f68f3c58 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java @@ -40,6 +40,10 @@ public class ItemCooldowns { private static final Map<ItemStack, Float> durabilityOverrideMap = new HashMap<>(); public static long pickaxeUseCooldownMillisRemaining = -1; private static long treecapitatorCooldownMillisRemaining = -1; + + public static boolean firstLoad = true; + public static long firstLoadMillis = 0; + private static long lastMillis = 0; public static long pickaxeCooldown = -1; @@ -57,6 +61,11 @@ public class ItemCooldowns { } long currentTime = System.currentTimeMillis(); + if (firstLoad) { + firstLoadMillis = currentTime; + firstLoad = false; + } + Long key; while ((key = blocksClicked.floorKey(currentTime - 1500)) != null) { @@ -78,7 +87,7 @@ public class ItemCooldowns { } @SubscribeEvent - public void onWorldUnload(WorldEvent.Load event) { + public void onWorldLoad(WorldEvent.Load event) { blocksClicked.clear(); if (pickaxeCooldown > 0) pickaxeUseCooldownMillisRemaining = 60 * 1000; pickaxeCooldown = -1; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index 03fe9eff..4fe3aa8d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -397,6 +397,12 @@ public class MiningOverlay extends TextTabOverlay { } } + if (ItemCooldowns.firstLoadMillis > 0) { + //set cooldown on first skyblock load. + ItemCooldowns.pickaxeUseCooldownMillisRemaining = 60 * 1000 - (System.currentTimeMillis() - ItemCooldowns.firstLoadMillis); + ItemCooldowns.firstLoadMillis = 0; + } + String pickaxeCooldown; if (ItemCooldowns.pickaxeUseCooldownMillisRemaining <= 0) { pickaxeCooldown = DARK_AQUA + "Pickaxe CD: \u00a7aReady"; |