Update buildscript & apply automatic formatting rules

This commit is contained in:
Raven Szewczyk authored and Jason Mitchell committed 2022-06-27 10:23:18 -07:00
1 parent a7683b885d
commit f7a900e910
173 files changed
+4581 -5321

No files matched your search

@@ -3,11 +3,9 @@ package codechicken.nei;
import com.google.common.base.Objects;
import cpw.mods.fml.common.FMLCommonHandler;
public class ThreadOperationTimer extends Thread
{
public class ThreadOperationTimer extends Thread {
@SuppressWarnings("serial")
public static class TimeoutException extends RuntimeException
{
public static class TimeoutException extends RuntimeException {
public final Object operation;
public TimeoutException(String msg, Object op) {
@@ -22,7 +20,7 @@ public class ThreadOperationTimer extends Thread
private long limit;
private ThreadOperationTimer(Thread thread, int limit) {
super(thread.getName()+" Operation Timer");
super(thread.getName() + " Operation Timer");
this.thread = thread;
this.limit = limit;
}
@@ -41,7 +39,7 @@ public class ThreadOperationTimer extends Thread
}
public synchronized void update(Object op) {
if(!Objects.equal(operation, op)) {
if (!Objects.equal(operation, op)) {
operation = op;
opTime = System.currentTimeMillis();
}
@@ -50,20 +48,23 @@ public class ThreadOperationTimer extends Thread
@SuppressWarnings("deprecation")
@Override
public void run() {
if(FMLCommonHandler.instance().findContainerFor("NotEnoughItems").getVersion().contains("$"))
return;//don't run this thread in a source environment
if (FMLCommonHandler.instance()
.findContainerFor("NotEnoughItems")
.getVersion()
.contains("$")) return; // don't run this thread in a source environment
while (thread.isAlive()) {
synchronized (this) {
if (operation != null && System.currentTimeMillis() - opTime > limit) {
// Thread.stop(Throwable) is hard-deprecated and IntelliJ complains about it.
//thread.stop(new TimeoutException("Operation took too long", operation));
// thread.stop(new TimeoutException("Operation took too long", operation));
thread.stop();
}
}
try {
Thread.sleep(50);
} catch (InterruptedException ie) {}
} catch (InterruptedException ie) {
}
}
}
@@ -72,4 +73,4 @@ public class ThreadOperationTimer extends Thread
t.start();
return t;
}
}
}