tickRegion = manager.getTileEntityRegion(hashCode);
if (tickRegion != null) {
tickRegion.profilingEnabled = false;
}
}
sendChat(commandSender, entityTickProfiler.writeStringData(new TableFormatter(commandSender)).toString());
}
}, location ? ProfilingState.CHUNK : ProfilingState.GLOBAL, time, worlds)) {
sendChat(commandSender, "Someone else is currently profiling.");
}
if (location) {
manager.profilingEnabled = false;
TickRegion tickRegion = manager.getEntityRegion(hashCode);
if (tickRegion != null) {
tickRegion.profilingEnabled = true;
}
tickRegion = manager.getTileEntityRegion(hashCode);
if (tickRegion != null) {
tickRegion.profilingEnabled = true;
}
}
sendChat(commandSender, "Profiling for " + time + " seconds in " + (world == null ? "all worlds " : Log.name(world)) + (location ? " at chunk coords " + x + ',' + z : ""));
return;
}
if (Timings.enabled) {
sendChat(commandSender, "Someone else is currently profiling, please wait and try again.");
return;
}
Timings.enabled = true;
Runnable profilingRunnable = new Runnable() {
@Override
public void run() {
try {
Thread.sleep(1000 * time);
} catch (InterruptedException ignored) {
}
Timings.enabled = false;
try {
Thread.sleep(100 * time);
} catch (InterruptedException ignored) {
}
sendChat(commandSender, String.valueOf(Timings.writeData(new TableFormatter(commandSender))));
Timings.clear();
}
};
Thread profilingThread = new Thread(profilingRunnable);
profilingThread.setName("TT Profiler");