Skip to content

Commit 119ce1e

Browse files
committed
Enable timer hack only on Windows
1 parent e6bd0d0 commit 119ce1e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/main/java/net/raphimc/noteblocklib/util/TimerHack.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
*/
1818
package net.raphimc.noteblocklib.util;
1919

20+
import java.util.Locale;
21+
2022
public class TimerHack {
2123

2224
/**
2325
* Set this to false (Before using the NoteBlockLib API) to disable the timer hack (Useful if you have your own way of enabling high resolution timers)
2426
*/
25-
public static boolean ENABLED = true;
27+
public static boolean ENABLED = System.getProperty("os.name").toLowerCase(Locale.ROOT).startsWith("windows");
2628
private static Thread THREAD;
2729

2830
/**
@@ -33,7 +35,7 @@ public static synchronized void ensureRunning() {
3335
THREAD = new Thread(() -> {
3436
while (true) {
3537
try {
36-
Thread.sleep(Integer.MAX_VALUE);
38+
Thread.sleep(Long.MAX_VALUE);
3739
} catch (InterruptedException ignored) {
3840
}
3941
}

0 commit comments

Comments
 (0)