Metrics and watchdog
This commit is contained in:
parent
1176626e5e
commit
0503dd73fd
|
@ -1,61 +1,9 @@
|
||||||
From 2ba22ed3cb7fcfbf52fd7bade08af98b4152e9cb Mon Sep 17 00:00:00 2001
|
From 6d588b92bf8282f25ed30e7660a338f160a500bc Mon Sep 17 00:00:00 2001
|
||||||
From: md_5 <md_5@live.com.au>
|
From: md_5 <md_5@live.com.au>
|
||||||
Date: Sat, 23 Feb 2013 08:58:35 +1100
|
Date: Sat, 23 Feb 2013 08:58:35 +1100
|
||||||
Subject: [PATCH] Metrics
|
Subject: [PATCH] Metrics
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
|
||||||
index 2fc33f8..2532aa2 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
|
||||||
@@ -1,8 +1,10 @@
|
|
||||||
package org.bukkit.craftbukkit;
|
|
||||||
|
|
||||||
+import java.io.IOException;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
+import java.util.logging.Level;
|
|
||||||
import net.minecraft.server.AxisAlignedBB;
|
|
||||||
import net.minecraft.server.Chunk;
|
|
||||||
import net.minecraft.server.Entity;
|
|
||||||
@@ -29,8 +31,10 @@ import net.minecraft.server.MathHelper;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.server.PendingConnection;
|
|
||||||
import net.minecraft.server.World;
|
|
||||||
+import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.SimpleCommandMap;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
+import org.spigotmc.Metrics;
|
|
||||||
|
|
||||||
public class Spigot {
|
|
||||||
|
|
||||||
@@ -39,6 +43,8 @@ public class Spigot {
|
|
||||||
static AxisAlignedBB animalBB = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
|
|
||||||
static AxisAlignedBB monsterBB = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
|
|
||||||
private static boolean filterIps;
|
|
||||||
+ public static boolean tabPing = false;
|
|
||||||
+ private static Metrics metrics;
|
|
||||||
|
|
||||||
public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) {
|
|
||||||
commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps"));
|
|
||||||
@@ -62,6 +68,16 @@ public class Spigot {
|
|
||||||
server.getLogger().severe("[Spigot] You should not disable chunk-gc, unexpected behaviour may occur!");
|
|
||||||
}
|
|
||||||
|
|
||||||
+ tabPing = configuration.getBoolean("settings.tab-ping", tabPing);
|
|
||||||
+
|
|
||||||
+ if (metrics == null) {
|
|
||||||
+ try {
|
|
||||||
+ metrics = new Metrics();
|
|
||||||
+ metrics.start();
|
|
||||||
+ } catch (IOException ex) {
|
|
||||||
+ Bukkit.getServer().getLogger().log(Level.SEVERE, "Could not start metrics service", ex);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
diff --git a/src/main/java/org/spigotmc/Metrics.java b/src/main/java/org/spigotmc/Metrics.java
|
diff --git a/src/main/java/org/spigotmc/Metrics.java b/src/main/java/org/spigotmc/Metrics.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..f1690a2
|
index 0000000..f1690a2
|
||||||
|
@ -708,6 +656,37 @@ index 0000000..f1690a2
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
\ No newline at end of file
|
\ No newline at end of file
|
||||||
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||||
|
index d647943..fde9250 100644
|
||||||
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
||||||
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||||
|
@@ -29,6 +29,7 @@ public class SpigotConfig
|
||||||
|
static YamlConfiguration config;
|
||||||
|
static int version;
|
||||||
|
/*========================================================================*/
|
||||||
|
+ private static Metrics metrics;
|
||||||
|
|
||||||
|
public static void init()
|
||||||
|
{
|
||||||
|
@@ -38,6 +39,18 @@ public class SpigotConfig
|
||||||
|
|
||||||
|
version = getInt( "config-version", 1 );
|
||||||
|
readConfig( SpigotConfig.class, null );
|
||||||
|
+
|
||||||
|
+ if ( metrics == null )
|
||||||
|
+ {
|
||||||
|
+ try
|
||||||
|
+ {
|
||||||
|
+ metrics = new Metrics();
|
||||||
|
+ metrics.start();
|
||||||
|
+ } catch ( IOException ex )
|
||||||
|
+ {
|
||||||
|
+ Bukkit.getServer().getLogger().log( Level.SEVERE, "Could not start metrics service", ex );
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
static void readConfig(Class<?> clazz, Object instance)
|
||||||
--
|
--
|
||||||
1.8.1.2
|
1.8.1.2
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From 38b16a25eb92ac69f11bc50e958ad1eaf48471b7 Mon Sep 17 00:00:00 2001
|
From c6b9aaf6ba62817a2cff96441552a2df4b91601a Mon Sep 17 00:00:00 2001
|
||||||
From: md_5 <md_5@live.com.au>
|
From: md_5 <md_5@live.com.au>
|
||||||
Date: Sat, 23 Feb 2013 12:33:20 +1100
|
Date: Sat, 23 Feb 2013 12:33:20 +1100
|
||||||
Subject: [PATCH] Watchdog Thread.
|
Subject: [PATCH] Watchdog Thread.
|
||||||
|
@ -24,169 +24,149 @@ index db396b3..d197f06 100644
|
||||||
this.stop();
|
this.stop();
|
||||||
this.isStopped = true;
|
this.isStopped = true;
|
||||||
} catch (Throwable throwable1) {
|
} catch (Throwable throwable1) {
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java
|
||||||
index 2532aa2..6a164ca 100644
|
new file mode 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
index 0000000..a5c4549
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
--- /dev/null
|
||||||
@@ -1,5 +1,6 @@
|
+++ b/src/main/java/org/spigotmc/RestartCommand.java
|
||||||
package org.bukkit.craftbukkit;
|
@@ -0,0 +1,111 @@
|
||||||
|
+package org.spigotmc;
|
||||||
|
+
|
||||||
+import java.io.File;
|
+import java.io.File;
|
||||||
import java.io.IOException;
|
+import java.util.List;
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
@@ -20,6 +21,7 @@ import net.minecraft.server.EntityFireworks;
|
|
||||||
import net.minecraft.server.EntityHuman;
|
|
||||||
import net.minecraft.server.EntityLiving;
|
|
||||||
import net.minecraft.server.EntityMonster;
|
|
||||||
+import net.minecraft.server.EntityPlayer;
|
+import net.minecraft.server.EntityPlayer;
|
||||||
import net.minecraft.server.EntityProjectile;
|
+import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.EntitySheep;
|
|
||||||
import net.minecraft.server.EntitySlime;
|
|
||||||
@@ -29,12 +31,15 @@ import net.minecraft.server.EntityWeather;
|
|
||||||
import net.minecraft.server.EntityWither;
|
|
||||||
import net.minecraft.server.MathHelper;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
+import net.minecraft.server.Packet255KickDisconnect;
|
+import net.minecraft.server.Packet255KickDisconnect;
|
||||||
import net.minecraft.server.PendingConnection;
|
+import org.bukkit.command.Command;
|
||||||
import net.minecraft.server.World;
|
+import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.Bukkit;
|
+
|
||||||
import org.bukkit.command.SimpleCommandMap;
|
+public class RestartCommand extends Command
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
+{
|
||||||
import org.spigotmc.Metrics;
|
+
|
||||||
+import org.spigotmc.RestartCommand;
|
+ public RestartCommand(String name)
|
||||||
+import org.spigotmc.WatchdogThread;
|
+ {
|
||||||
|
+ super( name );
|
||||||
public class Spigot {
|
+ this.description = "Restarts the server";
|
||||||
|
+ this.usageMessage = "/restart";
|
||||||
@@ -48,6 +53,7 @@ public class Spigot {
|
+ this.setPermission( "bukkit.command.restart" );
|
||||||
|
+ }
|
||||||
public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) {
|
+
|
||||||
commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps"));
|
+ @Override
|
||||||
+ commandMap.register("restart", new RestartCommand("restart"));
|
+ public boolean execute(CommandSender sender, String currentAlias, String[] args)
|
||||||
|
+ {
|
||||||
server.whitelistMessage = configuration.getString("settings.whitelist-message", server.whitelistMessage);
|
+ if ( testPermission( sender ) )
|
||||||
server.stopMessage = configuration.getString("settings.stop-message", server.stopMessage);
|
+ {
|
||||||
@@ -56,6 +62,17 @@ public class Spigot {
|
+ restart();
|
||||||
server.spamGuardExclusions = configuration.getStringList("settings.spam-exclusions");
|
|
||||||
filterIps = configuration.getBoolean("settings.filter-unsafe-ips", false);
|
|
||||||
|
|
||||||
+ int configVersion = configuration.getInt("config-version");
|
|
||||||
+ switch (configVersion) {
|
|
||||||
+ case 0:
|
|
||||||
+ configuration.set("settings.timeout-time", 30);
|
|
||||||
+ case 1:
|
|
||||||
+ configuration.set("settings.timeout-time", 60);
|
|
||||||
+ }
|
+ }
|
||||||
+ configuration.set("config-version", 2);
|
+ return true;
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ WatchdogThread.doStart(configuration.getInt("settings.timeout-time", 60), configuration.getBoolean("settings.restart-on-crash", false));
|
+ public static void restart()
|
||||||
+
|
+ {
|
||||||
server.orebfuscatorEnabled = configuration.getBoolean("orebfuscator.enable", false);
|
+ try
|
||||||
server.orebfuscatorEngineMode = configuration.getInt("orebfuscator.engine-mode", 1);
|
+ {
|
||||||
server.orebfuscatorDisabledWorlds = configuration.getStringList("orebfuscator.disabled-worlds");
|
+ final File file = new File( SpigotConfig.restartScript );
|
||||||
@@ -297,6 +314,66 @@ public class Spigot {
|
+ if ( file.isFile() )
|
||||||
return isActive;
|
+ {
|
||||||
}
|
+ System.out.println( "Attempting to restart with " + SpigotConfig.restartScript );
|
||||||
|
|
||||||
+ public static void restart() {
|
|
||||||
+ try {
|
|
||||||
+ String startupScript = MinecraftServer.getServer().server.configuration.getString("settings.restart-script-location", "");
|
|
||||||
+ final File file = new File(startupScript);
|
|
||||||
+ if (file.isFile()) {
|
|
||||||
+ System.out.println("Attempting to restart with " + startupScript);
|
|
||||||
+
|
+
|
||||||
+ // Kick all players
|
+ // Kick all players
|
||||||
+ for (EntityPlayer p : (List< EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
+ for ( EntityPlayer p : (List< EntityPlayer>) MinecraftServer.getServer().getPlayerList().players )
|
||||||
+ p.playerConnection.networkManager.queue(new Packet255KickDisconnect("Server is restarting"));
|
+ {
|
||||||
|
+ p.playerConnection.networkManager.queue( new Packet255KickDisconnect( "Server is restarting" ) );
|
||||||
+ p.playerConnection.networkManager.d();
|
+ p.playerConnection.networkManager.d();
|
||||||
+ }
|
+ }
|
||||||
+ // Give the socket a chance to send the packets
|
+ // Give the socket a chance to send the packets
|
||||||
+ try {
|
+ try
|
||||||
+ Thread.sleep(100);
|
+ {
|
||||||
+ } catch (InterruptedException ex) {
|
+ Thread.sleep( 100 );
|
||||||
|
+ } catch ( InterruptedException ex )
|
||||||
|
+ {
|
||||||
+ }
|
+ }
|
||||||
+ // Close the socket so we can rebind with the new process
|
+ // Close the socket so we can rebind with the new process
|
||||||
+ MinecraftServer.getServer().ae().a();
|
+ MinecraftServer.getServer().ae().a();
|
||||||
+
|
+
|
||||||
+ // Give time for it to kick in
|
+ // Give time for it to kick in
|
||||||
+ try {
|
+ try
|
||||||
+ Thread.sleep(100);
|
+ {
|
||||||
+ } catch (InterruptedException ex) {
|
+ Thread.sleep( 100 );
|
||||||
|
+ } catch ( InterruptedException ex )
|
||||||
|
+ {
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ // Actually shutdown
|
+ // Actually shutdown
|
||||||
+ try {
|
+ try
|
||||||
|
+ {
|
||||||
+ MinecraftServer.getServer().stop();
|
+ MinecraftServer.getServer().stop();
|
||||||
+ } catch (Throwable t) {
|
+ } catch ( Throwable t )
|
||||||
|
+ {
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ // This will be done AFTER the server has completely halted
|
+ // This will be done AFTER the server has completely halted
|
||||||
+ Thread shutdownHook = new Thread() {
|
+ Thread shutdownHook = new Thread()
|
||||||
|
+ {
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void run() {
|
+ public void run()
|
||||||
+ try {
|
+ {
|
||||||
+ String os = System.getProperty("os.name").toLowerCase();
|
+ try
|
||||||
+ if (os.contains("win")) {
|
+ {
|
||||||
+ Runtime.getRuntime().exec("cmd /c start " + file.getPath());
|
+ String os = System.getProperty( "os.name" ).toLowerCase();
|
||||||
+ } else {
|
+ if ( os.contains( "win" ) )
|
||||||
+ Runtime.getRuntime().exec(new String[]{"sh", file.getPath()});
|
+ {
|
||||||
|
+ Runtime.getRuntime().exec( "cmd /c start " + file.getPath() );
|
||||||
|
+ } else
|
||||||
|
+ {
|
||||||
|
+ Runtime.getRuntime().exec( new String[]
|
||||||
|
+ {
|
||||||
|
+ "sh", file.getPath()
|
||||||
|
+ } );
|
||||||
+ }
|
+ }
|
||||||
+ } catch (Exception e) {
|
+ } catch ( Exception e )
|
||||||
|
+ {
|
||||||
+ e.printStackTrace();
|
+ e.printStackTrace();
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ };
|
+ };
|
||||||
+
|
+
|
||||||
+ shutdownHook.setDaemon(true);
|
+ shutdownHook.setDaemon( true );
|
||||||
+ Runtime.getRuntime().addShutdownHook(shutdownHook);
|
+ Runtime.getRuntime().addShutdownHook( shutdownHook );
|
||||||
+ } else {
|
+ } else
|
||||||
+ System.out.println("Startup script '" + startupScript + "' does not exist! Stopping server.");
|
+ {
|
||||||
|
+ System.out.println( "Startup script '" + SpigotConfig.restartScript + "' does not exist! Stopping server." );
|
||||||
+ }
|
+ }
|
||||||
+ System.exit(0);
|
+ System.exit( 0 );
|
||||||
+ } catch (Exception ex) {
|
+ } catch ( Exception ex )
|
||||||
|
+ {
|
||||||
+ ex.printStackTrace();
|
+ ex.printStackTrace();
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
public static boolean filterIp(PendingConnection con) {
|
|
||||||
if (filterIps) {
|
|
||||||
try {
|
|
||||||
diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..2d5c89f
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/org/spigotmc/RestartCommand.java
|
|
||||||
@@ -0,0 +1,23 @@
|
|
||||||
+package org.spigotmc;
|
|
||||||
+
|
|
||||||
+import org.bukkit.command.Command;
|
|
||||||
+import org.bukkit.command.CommandSender;
|
|
||||||
+import org.bukkit.craftbukkit.Spigot;
|
|
||||||
+
|
|
||||||
+public class RestartCommand extends Command {
|
|
||||||
+
|
|
||||||
+ public RestartCommand(String name) {
|
|
||||||
+ super(name);
|
|
||||||
+ this.description = "Restarts the server";
|
|
||||||
+ this.usageMessage = "/restart";
|
|
||||||
+ this.setPermission("bukkit.command.restart");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public boolean execute(CommandSender sender, String currentAlias, String[] args) {
|
|
||||||
+ if (testPermission(sender)) {
|
|
||||||
+ Spigot.restart();
|
|
||||||
+ }
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+}
|
+}
|
||||||
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||||
|
index fde9250..2fe3a5d 100644
|
||||||
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
||||||
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||||
|
@@ -119,4 +119,15 @@ public class SpigotConfig
|
||||||
|
{
|
||||||
|
preventProxies = getBoolean( "settings.prevent-proxies", preventProxies );
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ public static int timeoutTime = 60;
|
||||||
|
+ public static boolean restartOnCrash = true;
|
||||||
|
+ public static String restartScript = "./start.sh";
|
||||||
|
+ private static void watchdog()
|
||||||
|
+ {
|
||||||
|
+ timeoutTime = getInt( "settings.timeout-time", timeoutTime );
|
||||||
|
+ restartOnCrash = getBoolean( "settings.restart-on-crash", restartOnCrash );
|
||||||
|
+ restartScript = getString( "settings.restart-script", restartScript );
|
||||||
|
+ WatchdogThread.doStart( timeoutTime, restartOnCrash );
|
||||||
|
+ }
|
||||||
|
}
|
||||||
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
|
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..10390b8
|
index 0000000..38ef9b7
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
|
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||||
@@ -0,0 +1,93 @@
|
@@ -0,0 +1,110 @@
|
||||||
+package org.spigotmc;
|
+package org.spigotmc;
|
||||||
+
|
+
|
||||||
+import java.lang.management.ManagementFactory;
|
+import java.lang.management.ManagementFactory;
|
||||||
|
@ -195,9 +175,9 @@ index 0000000..10390b8
|
||||||
+import java.util.logging.Level;
|
+import java.util.logging.Level;
|
||||||
+import java.util.logging.Logger;
|
+import java.util.logging.Logger;
|
||||||
+import org.bukkit.Bukkit;
|
+import org.bukkit.Bukkit;
|
||||||
+import org.bukkit.craftbukkit.Spigot;
|
|
||||||
+
|
+
|
||||||
+public class WatchdogThread extends Thread {
|
+public class WatchdogThread extends Thread
|
||||||
|
+{
|
||||||
+
|
+
|
||||||
+ private static WatchdogThread instance;
|
+ private static WatchdogThread instance;
|
||||||
+ private final long timeoutTime;
|
+ private final long timeoutTime;
|
||||||
|
@ -205,95 +185,98 @@ index 0000000..10390b8
|
||||||
+ private volatile long lastTick;
|
+ private volatile long lastTick;
|
||||||
+ private volatile boolean stopping;
|
+ private volatile boolean stopping;
|
||||||
+
|
+
|
||||||
+ private WatchdogThread(long timeoutTime, boolean restart) {
|
+ private WatchdogThread(long timeoutTime, boolean restart)
|
||||||
+ super("Spigot Watchdog Thread");
|
+ {
|
||||||
|
+ super( "Spigot Watchdog Thread" );
|
||||||
+ this.timeoutTime = timeoutTime;
|
+ this.timeoutTime = timeoutTime;
|
||||||
+ this.restart = restart;
|
+ this.restart = restart;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public static void doStart(int timeoutTime, boolean restart) {
|
+ public static void doStart(int timeoutTime, boolean restart)
|
||||||
+ if (instance == null) {
|
+ {
|
||||||
+ instance = new WatchdogThread(timeoutTime * 1000L, restart);
|
+ if ( instance == null )
|
||||||
|
+ {
|
||||||
|
+ instance = new WatchdogThread( timeoutTime * 1000L, restart );
|
||||||
+ instance.start();
|
+ instance.start();
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public static void tick() {
|
+ public static void tick()
|
||||||
|
+ {
|
||||||
+ instance.lastTick = System.currentTimeMillis();
|
+ instance.lastTick = System.currentTimeMillis();
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public static void doStop() {
|
+ public static void doStop()
|
||||||
+ if (instance != null) {
|
+ {
|
||||||
|
+ if ( instance != null )
|
||||||
|
+ {
|
||||||
+ instance.stopping = true;
|
+ instance.stopping = true;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void run() {
|
+ public void run()
|
||||||
+ while (!stopping) {
|
+ {
|
||||||
|
+ while ( !stopping )
|
||||||
|
+ {
|
||||||
+ //
|
+ //
|
||||||
+ if (lastTick != 0 && System.currentTimeMillis() > lastTick + timeoutTime) {
|
+ if ( lastTick != 0 && System.currentTimeMillis() > lastTick + timeoutTime )
|
||||||
|
+ {
|
||||||
+ Logger log = Bukkit.getServer().getLogger();
|
+ Logger log = Bukkit.getServer().getLogger();
|
||||||
+ log.log(Level.SEVERE, "The server has stopped responding!");
|
+ log.log( Level.SEVERE, "The server has stopped responding!" );
|
||||||
+ log.log(Level.SEVERE, "Please report this to http://www.spigotmc.org/");
|
+ log.log( Level.SEVERE, "Please report this to http://www.spigotmc.org/" );
|
||||||
+ log.log(Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports");
|
+ log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
|
||||||
+ log.log(Level.SEVERE, "Spigot version: " + Bukkit.getServer().getVersion());
|
+ log.log( Level.SEVERE, "Spigot version: " + Bukkit.getServer().getVersion() );
|
||||||
+ //
|
+ //
|
||||||
+ log.log(Level.SEVERE, "Current Thread State:");
|
+ log.log( Level.SEVERE, "Current Thread State:" );
|
||||||
+ ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads(true, true);
|
+ ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads( true, true );
|
||||||
+ for (ThreadInfo thread : threads) {
|
+ for ( ThreadInfo thread : threads )
|
||||||
+ if (thread.getThreadState() != State.WAITING) {
|
+ {
|
||||||
+ log.log(Level.SEVERE, "------------------------------");
|
+ if ( thread.getThreadState() != State.WAITING )
|
||||||
|
+ {
|
||||||
|
+ log.log( Level.SEVERE, "------------------------------" );
|
||||||
+ //
|
+ //
|
||||||
+ log.log(Level.SEVERE, "Current Thread: " + thread.getThreadName());
|
+ log.log( Level.SEVERE, "Current Thread: " + thread.getThreadName() );
|
||||||
+ log.log(Level.SEVERE, "\tPID: " + thread.getThreadId()
|
+ log.log( Level.SEVERE, "\tPID: " + thread.getThreadId()
|
||||||
+ + " | Suspended: " + thread.isSuspended()
|
+ + " | Suspended: " + thread.isSuspended()
|
||||||
+ + " | Native: " + thread.isInNative()
|
+ + " | Native: " + thread.isInNative()
|
||||||
+ + " | State: " + thread.getThreadState());
|
+ + " | State: " + thread.getThreadState() );
|
||||||
+ if (thread.getLockedMonitors().length != 0) {
|
+ if ( thread.getLockedMonitors().length != 0 )
|
||||||
+ log.log(Level.SEVERE, "\tThread is waiting on monitor(s):");
|
+ {
|
||||||
+ for (MonitorInfo monitor : thread.getLockedMonitors()) {
|
+ log.log( Level.SEVERE, "\tThread is waiting on monitor(s):" );
|
||||||
+ log.log(Level.SEVERE, "\t\tLocked on:" + monitor.getLockedStackFrame());
|
+ for ( MonitorInfo monitor : thread.getLockedMonitors() )
|
||||||
|
+ {
|
||||||
|
+ log.log( Level.SEVERE, "\t\tLocked on:" + monitor.getLockedStackFrame() );
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ log.log(Level.SEVERE, "\tStack:");
|
+ log.log( Level.SEVERE, "\tStack:" );
|
||||||
+ //
|
+ //
|
||||||
+ StackTraceElement[] stack = thread.getStackTrace();
|
+ StackTraceElement[] stack = thread.getStackTrace();
|
||||||
+ for (int line = 0; line < stack.length; line++) {
|
+ for ( int line = 0; line < stack.length; line++ )
|
||||||
+ log.log(Level.SEVERE, "\t\t" + stack[line].toString());
|
+ {
|
||||||
|
+ log.log( Level.SEVERE, "\t\t" + stack[line].toString() );
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ log.log(Level.SEVERE, "------------------------------");
|
+ log.log( Level.SEVERE, "------------------------------" );
|
||||||
+
|
+
|
||||||
+ if (restart) {
|
+ if ( restart )
|
||||||
+ Spigot.restart();
|
+ {
|
||||||
|
+ RestartCommand.restart();
|
||||||
+ }
|
+ }
|
||||||
+ break;
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ try {
|
+ try
|
||||||
+ sleep(10000);
|
+ {
|
||||||
+ } catch (InterruptedException ex) {
|
+ sleep( 10000 );
|
||||||
|
+ } catch ( InterruptedException ex )
|
||||||
|
+ {
|
||||||
+ interrupt();
|
+ interrupt();
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
|
|
||||||
index 9c64871..3d4272b 100644
|
|
||||||
--- a/src/main/resources/configurations/bukkit.yml
|
|
||||||
+++ b/src/main/resources/configurations/bukkit.yml
|
|
||||||
@@ -31,6 +31,9 @@ settings:
|
|
||||||
spam-exclusions:
|
|
||||||
- /skill
|
|
||||||
filter-unsafe-ips: false
|
|
||||||
+ timeout-time: 30
|
|
||||||
+ restart-on-crash: false
|
|
||||||
+ restart-script-location: /path/to/server/start.sh
|
|
||||||
world-settings:
|
|
||||||
default:
|
|
||||||
growth-chunks-per-tick: 650
|
|
||||||
--
|
--
|
||||||
1.8.1.2
|
1.8.1.2
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From 5146e6a561c2858de9a0d2a44dadde9db0b7a8a6 Mon Sep 17 00:00:00 2001
|
From 184b38aa96c6eb71116c452bff126cd7df9db814 Mon Sep 17 00:00:00 2001
|
||||||
From: md_5 <md_5@live.com.au>
|
From: md_5 <md_5@live.com.au>
|
||||||
Date: Tue, 23 Apr 2013 11:47:32 +1000
|
Date: Tue, 23 Apr 2013 11:47:32 +1000
|
||||||
Subject: [PATCH] Netty
|
Subject: [PATCH] Netty
|
||||||
|
@ -53,7 +53,7 @@ index 8c9f66b..a33020e 100644
|
||||||
|
|
||||||
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
||||||
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||||
index 10ce69d..e4f1cbe 100644
|
index 6668b7e..b2a4229 100644
|
||||||
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||||
@@ -96,7 +96,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
@@ -96,7 +96,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||||
|
@ -131,7 +131,7 @@ index 1862863..5a24f2a 100644
|
||||||
+ public void setSocketAddress(SocketAddress address) { k = address; } // Spigot
|
+ public void setSocketAddress(SocketAddress address) { k = address; } // Spigot
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/Packet51MapChunk.java b/src/main/java/net/minecraft/server/Packet51MapChunk.java
|
diff --git a/src/main/java/net/minecraft/server/Packet51MapChunk.java b/src/main/java/net/minecraft/server/Packet51MapChunk.java
|
||||||
index 7711629..9cf625d 100644
|
index efe102e..e488fa8 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Packet51MapChunk.java
|
--- a/src/main/java/net/minecraft/server/Packet51MapChunk.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Packet51MapChunk.java
|
+++ b/src/main/java/net/minecraft/server/Packet51MapChunk.java
|
||||||
@@ -42,7 +42,7 @@ public class Packet51MapChunk extends Packet {
|
@@ -42,7 +42,7 @@ public class Packet51MapChunk extends Packet {
|
||||||
|
@ -144,7 +144,7 @@ index 7711629..9cf625d 100644
|
||||||
this.d = chunkmap.c;
|
this.d = chunkmap.c;
|
||||||
this.c = chunkmap.b;
|
this.c = chunkmap.b;
|
||||||
diff --git a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
|
diff --git a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
|
||||||
index ce28495..fb34d4a 100644
|
index a2cd9b0..f586415 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
|
--- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
|
+++ b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
|
||||||
@@ -24,7 +24,7 @@ public class Packet56MapChunkBulk extends Packet {
|
@@ -24,7 +24,7 @@ public class Packet56MapChunkBulk extends Packet {
|
||||||
|
@ -210,10 +210,10 @@ index 17cfacc..a945892 100644
|
||||||
this.b = true;
|
this.b = true;
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 82dfef1..2485ef9 100644
|
index 2567bde..7f5f3ea 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -1389,4 +1389,20 @@ public final class CraftServer implements Server {
|
@@ -1367,4 +1367,20 @@ public final class CraftServer implements Server {
|
||||||
public CraftScoreboardManager getScoreboardManager() {
|
public CraftScoreboardManager getScoreboardManager() {
|
||||||
return scoreboardManager;
|
return scoreboardManager;
|
||||||
}
|
}
|
||||||
|
@ -1500,7 +1500,7 @@ index 0000000..d3a9cab
|
||||||
+ DATA;
|
+ DATA;
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
|
diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
|
||||||
index 3d4272b..53db120 100644
|
index 61a95e3..e65758d 100644
|
||||||
--- a/src/main/resources/configurations/bukkit.yml
|
--- a/src/main/resources/configurations/bukkit.yml
|
||||||
+++ b/src/main/resources/configurations/bukkit.yml
|
+++ b/src/main/resources/configurations/bukkit.yml
|
||||||
@@ -13,6 +13,9 @@
|
@@ -13,6 +13,9 @@
|
||||||
|
|
Loading…
Reference in New Issue