3
0

move yumc statistics to DedicatedServer

This commit is contained in:
xjboss 2017-07-23 13:20:29 +08:00
parent 787f48b912
commit e5dae008ef
2 changed files with 18 additions and 17 deletions

View File

@ -8,7 +8,7 @@
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import java.io.BufferedReader; import java.io.BufferedReader;
@@ -34,9 +35,23 @@ @@ -34,9 +35,24 @@
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldSettings; import net.minecraft.world.WorldSettings;
import net.minecraft.world.WorldType; import net.minecraft.world.WorldType;
@ -27,12 +27,13 @@
+import org.bukkit.craftbukkit.SpigotTimings; // Spigot +import org.bukkit.craftbukkit.SpigotTimings; // Spigot
+import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerLoginEvent;
+import org.bukkit.event.server.ServerCommandEvent; +import org.bukkit.event.server.ServerCommandEvent;
+import pw.yumc.KCXStatistics;
+// CraftBukkit end +// CraftBukkit end
+ +
@SideOnly(Side.SERVER) @SideOnly(Side.SERVER)
public class DedicatedServer extends MinecraftServer implements IServer public class DedicatedServer extends MinecraftServer implements IServer
{ {
@@ -44,7 +59,7 @@ @@ -44,18 +60,21 @@
public final List pendingCommandList = Collections.synchronizedList(new ArrayList()); public final List pendingCommandList = Collections.synchronizedList(new ArrayList());
private RConThreadQuery theRConThreadQuery; private RConThreadQuery theRConThreadQuery;
private RConThreadMain theRConThreadMain; private RConThreadMain theRConThreadMain;
@ -41,11 +42,12 @@
private ServerEula field_154332_n; private ServerEula field_154332_n;
private boolean canSpawnStructures; private boolean canSpawnStructures;
private WorldSettings.GameType gameType; private WorldSettings.GameType gameType;
@@ -52,10 +67,13 @@ private boolean guiIsEnabled;
public static boolean allowPlayerLogins = false; public static boolean allowPlayerLogins = false;
private static final String __OBFID = "CL_00001784"; private static final String __OBFID = "CL_00001784";
-
- public DedicatedServer(File p_i1508_1_) - public DedicatedServer(File p_i1508_1_)
+ private KCXStatistics yumc_statistics;
+ // CraftBukkit start - Signature changed + // CraftBukkit start - Signature changed
+ public DedicatedServer(joptsimple.OptionSet options) + public DedicatedServer(joptsimple.OptionSet options)
{ {
@ -58,7 +60,7 @@
{ {
private static final String __OBFID = "CL_00001787"; private static final String __OBFID = "CL_00001787";
{ {
@@ -82,31 +100,77 @@ @@ -82,31 +101,77 @@
}; };
} }
@ -143,7 +145,7 @@
field_155771_h.info("Starting minecraft server version 1.7.10"); field_155771_h.info("Starting minecraft server version 1.7.10");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L)
@@ -117,7 +181,7 @@ @@ -117,7 +182,7 @@
FMLCommonHandler.instance().onServerStart(this); FMLCommonHandler.instance().onServerStart(this);
field_155771_h.info("Loading properties"); field_155771_h.info("Loading properties");
@ -152,7 +154,7 @@
this.field_154332_n = new ServerEula(new File("eula.txt")); this.field_154332_n = new ServerEula(new File("eula.txt"));
if (!this.field_154332_n.func_154346_a()) if (!this.field_154332_n.func_154346_a())
@@ -172,6 +236,18 @@ @@ -172,6 +237,18 @@
this.setServerPort(this.settings.getIntProperty("server-port", 25565)); this.setServerPort(this.settings.getIntProperty("server-port", 25565));
} }
@ -171,7 +173,7 @@
field_155771_h.info("Generating keypair"); field_155771_h.info("Generating keypair");
this.setKeyPair(CryptManager.createNewKeyPair()); this.setKeyPair(CryptManager.createNewKeyPair());
field_155771_h.info("Starting Minecraft server on " + (this.getServerHostname().length() == 0 ? "*" : this.getServerHostname()) + ":" + this.getServerPort()); field_155771_h.info("Starting Minecraft server on " + (this.getServerHostname().length() == 0 ? "*" : this.getServerHostname()) + ":" + this.getServerPort());
@@ -180,7 +256,7 @@ @@ -180,7 +257,7 @@
{ {
this.func_147137_ag().addLanEndpoint(inetaddress, this.getServerPort()); this.func_147137_ag().addLanEndpoint(inetaddress, this.getServerPort());
} }
@ -180,7 +182,7 @@
{ {
field_155771_h.warn("**** FAILED TO BIND TO PORT!"); field_155771_h.warn("**** FAILED TO BIND TO PORT!");
field_155771_h.warn("The exception was: {}", new Object[] {ioexception.toString()}); field_155771_h.warn("The exception was: {}", new Object[] {ioexception.toString()});
@@ -196,10 +272,17 @@ @@ -196,10 +273,17 @@
field_155771_h.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file."); field_155771_h.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
} }
@ -200,7 +202,7 @@
if (!PreYggdrasilConverter.func_152714_a(this.settings)) if (!PreYggdrasilConverter.func_152714_a(this.settings))
{ {
@@ -208,7 +291,8 @@ @@ -208,7 +292,8 @@
else else
{ {
FMLCommonHandler.instance().onServerStarted(); FMLCommonHandler.instance().onServerStarted();
@ -210,7 +212,7 @@
long j = System.nanoTime(); long j = System.nanoTime();
if (this.getFolderName() == null) if (this.getFolderName() == null)
@@ -274,11 +358,36 @@ @@ -274,11 +359,40 @@
this.theRConThreadMain.startThread(); this.theRConThreadMain.startThread();
} }
@ -231,6 +233,10 @@
+ } + }
+ FakePlayer.fakePlayers=null; + FakePlayer.fakePlayers=null;
+ FakePlayer.BukkitInited=true; + FakePlayer.BukkitInited=true;
+ //Yumc Statistcs start
+ yumc_statistics=new KCXStatistics();
+ yumc_statistics.start();
+ //Yumc Statistcs end
+ // KCauldronX end + // KCauldronX end
return FMLCommonHandler.instance().handleServerStarting(this); return FMLCommonHandler.instance().handleServerStarting(this);
} }
@ -247,7 +253,7 @@
public boolean canStructuresSpawn() public boolean canStructuresSpawn()
{ {
return this.canSpawnStructures; return this.canSpawnStructures;
@@ -364,11 +473,19 @@ @@ -364,11 +478,19 @@
public void executePendingCommands() public void executePendingCommands()
{ {

View File

@ -43,7 +43,6 @@ public class SpigotConfig
static Map<String, Command> commands; static Map<String, Command> commands;
/*========================================================================*/ /*========================================================================*/
private static Metrics metrics; private static Metrics metrics;
private static KCXStatistics yumc_statistics;
public static void init() public static void init()
{ {
@ -76,10 +75,6 @@ public class SpigotConfig
Bukkit.getServer().getLogger().log( Level.SEVERE, "Could not start metrics service", ex ); Bukkit.getServer().getLogger().log( Level.SEVERE, "Could not start metrics service", ex );
} }
} }
if(yumc_statistics==null){
yumc_statistics=new KCXStatistics();
yumc_statistics.start();
}
} }
static void readConfig(Class<?> clazz, Object instance) static void readConfig(Class<?> clazz, Object instance)