aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-29 00:20:42 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-29 00:20:42 +0200
commitc71854634b925517847a8e6b4e178f9f771901f3 (patch)
tree38b9b7050df6ff02cd6e5f0b3e65c0d275a1216f /src/main/java/at
parent90de9a66b8125b8d68fd6390092720a1832aaf53 (diff)
downloadskyhanni-c71854634b925517847a8e6b4e178f9f771901f3.tar.gz
skyhanni-c71854634b925517847a8e6b4e178f9f771901f3.tar.bz2
skyhanni-c71854634b925517847a8e6b4e178f9f771901f3.zip
Removed Print Event Timings (spark exists)
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/DevData.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt26
2 files changed, 1 insertions, 30 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java b/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java
index 97ba39573..7bc48d2e7 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java
@@ -123,9 +123,4 @@ public class DevData {
@ConfigEditorBoolean
@ConfigAccordionId(id = 2)
public boolean filterBiomeIdBounds = true;
-
- @Expose
- @ConfigOption(name = "Print Event Timings", desc = "Prints every 10 seconds the timings of all SkyHanni events in the chat.")
- @ConfigEditorBoolean
- public boolean printEventTimings = false;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt
index c499c3f34..400c312fb 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt
@@ -1,42 +1,18 @@
package at.hannibal2.skyhanni.events
-import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.sorted
import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.fml.common.eventhandler.Event
abstract class LorenzEvent : Event() {
- companion object {
- val map = mutableMapOf<String, Long>()
- var lastPrint = 0L
- }
-
private val eventName by lazy {
this::class.simpleName
}
fun postAndCatch(): Boolean {
return runCatching {
- if (!SkyHanniMod.feature.dev.printEventTimings) {
- return MinecraftForge.EVENT_BUS.post(this)
- }
- val start = System.currentTimeMillis()
- val result = MinecraftForge.EVENT_BUS.post(this)
- val end = System.currentTimeMillis() - start
- eventName?.let { map.put(it, end + map.getOrDefault(it, 0)) }
- if (System.currentTimeMillis() > lastPrint + 10_000) {
- lastPrint = System.currentTimeMillis()
- println(" ")
- println("Event Timings!")
- for (entry in map.sorted()) {
- println(entry.key + ": " + entry.value + " ms")
- }
- println(" ")
- map.clear()
- }
- result
+ MinecraftForge.EVENT_BUS.post(this)
}.onFailure {
if (it is NoSuchMethodError) {
LorenzUtils.chat("§c[SkyHanni] You need to use a newer version of NotEnoughUpdates (alpha-11 or newer)! If you need help downloading it, go to the skyhanni discord.")