diff options
author | syeyoung <cyoung06@naver.com> | 2023-02-07 18:00:38 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2023-02-07 18:00:38 +0900 |
commit | f71dbf1441553e9884df64dcf64acebf12807810 (patch) | |
tree | 743962be27ed3be8e2c4f7f7926b5c6cd10c6b63 | |
parent | 35d20f0197824ca68fa23ff154ad5a1ca8211334 (diff) | |
download | Skyblock-Dungeons-Guide-f71dbf1441553e9884df64dcf64acebf12807810.tar.gz Skyblock-Dungeons-Guide-f71dbf1441553e9884df64dcf64acebf12807810.tar.bz2 Skyblock-Dungeons-Guide-f71dbf1441553e9884df64dcf64acebf12807810.zip |
- Make it actual feature
Signed-off-by: syeyoung <cyoung06@naver.com>
-rw-r--r-- | mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/FreezeListener.java | 6 | ||||
-rw-r--r-- | mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java | 1 |
2 files changed, 3 insertions, 4 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/FreezeListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/FreezeListener.java index 4bafd78b..235b678b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/FreezeListener.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/FreezeListener.java @@ -19,6 +19,7 @@ package kr.syeyoung.dungeonsguide.mod.events.listener; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -51,8 +52,7 @@ public class FreezeListener implements Runnable { @Override public void run() { while(!t.isInterrupted()) { - if (lastTick < System.currentTimeMillis()) { - + if (lastTick < System.currentTimeMillis() && FeatureRegistry.FREEZE_DETECTOR.isEnabled()) { ThreadMXBean bean = ManagementFactory.getThreadMXBean(); ThreadInfo[] infos = bean.dumpAllThreads(true, true); String stacktrace = Arrays.stream(infos).map(Object::toString) @@ -64,8 +64,6 @@ public class FreezeListener implements Runnable { clipboard.setContents(selection, selection); JOptionPane.showMessageDialog(null, "Your Minecraft Seems to be frozen!\nThreadump has been copied into your clipboard!", "DG Freeze Alert", JOptionPane.INFORMATION_MESSAGE); - - } try { Thread.sleep(16); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java index f9a558f3..b30d0a67 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java @@ -99,6 +99,7 @@ public class FeatureRegistry { public static final FeatureHideNameTags DUNGEON_HIDENAMETAGS = register(new FeatureHideNameTags()); public static final FeaturePlayerESP DUNGEON_PLAYERESP = register(new FeaturePlayerESP()); public static final SimpleFeature DUNGEON_INTERMODCOMM = register(new SimpleFeature("Dungeon.Teammates", "Communicate With Other's Dungeons Guide", "Sends total secret in the room to others\nSo that they can use the data to calculate total secret in dungeon run\n\nThis automates player chatting action, (chatting data) Thus it might be against hypixel's rules.\nBut mods like auto-gg which also automate player action and is kinda allowed mod exist so I'm leaving this feature.\nThis option is use-at-your-risk and you'll be responsible for ban if you somehow get banned because of this feature\n(Although it is not likely to happen)\nDefaults to off", "dungeon.intermodcomm", false)); + public static final SimpleFeature FREEZE_DETECTOR = register(new SimpleFeature("Misc", "Freeze Detector", "Detect freezes, and when mc freezes for more than 5s, copy threadump and show you a popup", "misc.freezedetect", false)); public static final FeatureWarnLowHealth DUNGEON_LOWHEALTH_WARN = register(new FeatureWarnLowHealth()); public static final FeatureDungeonScore DUNGEON_SCORE = register(new FeatureDungeonScore()); public static final FeatureDungeonTombs DUNGEON_TOMBS = register(new FeatureDungeonTombs()); |