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/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java | |
| 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/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java | 11 |
1 files changed, 10 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; |
