aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2')
-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.")