Introduced World Save Thread and some refractoring
This commit is contained in:
@ -28,7 +28,7 @@ public class RestartCommand extends Command
|
||||
}
|
||||
|
||||
public static void restart() {
|
||||
restart(false);
|
||||
restart(false);
|
||||
}
|
||||
|
||||
public static void restart(boolean forbidShutdown)
|
||||
@ -102,10 +102,10 @@ public class RestartCommand extends Command
|
||||
Runtime.getRuntime().addShutdownHook( shutdownHook );
|
||||
} else
|
||||
{
|
||||
if (forbidShutdown) {
|
||||
System.out.println("Attempt to restart server without restart script, decline request");
|
||||
return;
|
||||
}
|
||||
if (forbidShutdown) {
|
||||
System.out.println("Attempt to restart server without restart script, decline request");
|
||||
return;
|
||||
}
|
||||
System.out.println( "Startup script '" + SpigotConfig.restartScript + "' does not exist! Stopping server." );
|
||||
}
|
||||
cpw.mods.fml.common.FMLCommonHandler.instance().exitJava(0, false);
|
||||
|
@ -271,6 +271,6 @@ public class SpigotConfig
|
||||
public static int fullMatchRate;
|
||||
private static void fullMatchRate()
|
||||
{
|
||||
fullMatchRate = getInt( "settings.fullMatchRate", 10);
|
||||
fullMatchRate = getInt( "settings.fullMatchRate", 10);
|
||||
}
|
||||
}
|
||||
|
@ -283,8 +283,8 @@ public class SpigotWorldConfig
|
||||
public int entityMaxTickTime;
|
||||
private void maxTickTimes()
|
||||
{
|
||||
tileMaxTickTime = getInt("max-tick-time.tile", 50);
|
||||
entityMaxTickTime = getInt("max-tick-time.entity", 50);
|
||||
log("Tile Max Tick Time: " + tileMaxTickTime + "ms Entity max Tick Time: " + entityMaxTickTime + "ms");
|
||||
tileMaxTickTime = getInt("max-tick-time.tile", 50);
|
||||
entityMaxTickTime = getInt("max-tick-time.entity", 50);
|
||||
log("Tile Max Tick Time: " + tileMaxTickTime + "ms Entity max Tick Time: " + entityMaxTickTime + "ms");
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,25 @@
|
||||
package org.spigotmc;
|
||||
|
||||
public class TickLimiter {
|
||||
private final int maxTime;
|
||||
private long startTime;
|
||||
private int tick;
|
||||
private boolean shouldContinue;
|
||||
public TickLimiter(int maxTime) {
|
||||
this.maxTime = maxTime;
|
||||
}
|
||||
|
||||
public void initTick() {
|
||||
startTime = System.currentTimeMillis();
|
||||
tick = 0;
|
||||
shouldContinue = true;
|
||||
}
|
||||
|
||||
public boolean shouldContinue() {
|
||||
if (++tick >= 300 && shouldContinue) {
|
||||
tick = 0;
|
||||
shouldContinue = System.currentTimeMillis() - startTime < maxTime;
|
||||
}
|
||||
return shouldContinue;
|
||||
}
|
||||
private final int maxTime;
|
||||
private long startTime;
|
||||
private int tick;
|
||||
private boolean shouldContinue;
|
||||
public TickLimiter(int maxTime) {
|
||||
this.maxTime = maxTime;
|
||||
}
|
||||
|
||||
public void initTick() {
|
||||
startTime = System.currentTimeMillis();
|
||||
tick = 0;
|
||||
shouldContinue = true;
|
||||
}
|
||||
|
||||
public boolean shouldContinue() {
|
||||
if (++tick >= 300 && shouldContinue) {
|
||||
tick = 0;
|
||||
shouldContinue = System.currentTimeMillis() - startTime < maxTime;
|
||||
}
|
||||
return shouldContinue;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user