Update CraftBukkit to Minecraft 1.7.5
This commit is contained in:
@@ -46,7 +46,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
private static final Logger h = LogManager.getLogger();
|
||||
private static MinecraftServer i;
|
||||
public Convertable convertable; // CraftBukkit - private final -> public
|
||||
private final MojangStatisticsGenerator k = new MojangStatisticsGenerator("server", this, ap());
|
||||
private final MojangStatisticsGenerator k = new MojangStatisticsGenerator("server", this, aq());
|
||||
public File universe; // CraftBukkit - private final -> public
|
||||
private final List m = new ArrayList();
|
||||
private final ICommandHandler n;
|
||||
@@ -89,7 +89,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
private final MinecraftSessionService S;
|
||||
private long T = 0L;
|
||||
|
||||
// CraftBukkit start
|
||||
// CraftBukkit start - add fields
|
||||
public List<WorldServer> worlds = new ArrayList<WorldServer>();
|
||||
public org.bukkit.craftbukkit.CraftServer server;
|
||||
public OptionSet options;
|
||||
@@ -208,7 +208,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
|
||||
if (j == 0) {
|
||||
IDataManager idatamanager = new ServerNBTManager(server.getWorldContainer(), s1, true);
|
||||
if (this.P()) {
|
||||
if (this.Q()) {
|
||||
world = new DemoWorldServer(this, idatamanager, s1, dimension, this.methodProfiler);
|
||||
} else {
|
||||
// world =, b0 to dimension, added Environment and gen
|
||||
@@ -262,7 +262,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldInitEvent(world.getWorld()));
|
||||
|
||||
world.addIWorldAccess(new WorldManager(this, world));
|
||||
if (!this.L()) {
|
||||
if (!this.M()) {
|
||||
world.getWorldData().setGameType(this.getGamemode());
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
this.b("menu.generatingTerrain");
|
||||
byte b0 = 0;
|
||||
|
||||
// CraftBukkit start
|
||||
// CraftBukkit start - fire WorldLoadEvent and handle whether or not to keep the spawn in memory
|
||||
for (int m = 0; m < this.worlds.size(); ++m) {
|
||||
WorldServer worldserver = this.worlds.get(m);
|
||||
h.info("Preparing start region for level " + m + " (Seed: " + worldserver.getSeed() + ")");
|
||||
@@ -294,12 +294,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
}
|
||||
|
||||
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
|
||||
long j = ap();
|
||||
long j = aq();
|
||||
i = 0;
|
||||
|
||||
for (int k = -192; k <= 192 && this.isRunning(); k += 16) {
|
||||
for (int l = -192; l <= 192 && this.isRunning(); l += 16) {
|
||||
long i1 = ap();
|
||||
long i1 = aq();
|
||||
|
||||
if (i1 - j > 1000L) {
|
||||
this.a_("Preparing spawn area", i * 100 / 625);
|
||||
@@ -316,7 +316,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(world.getWorld()));
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.m();
|
||||
this.n();
|
||||
}
|
||||
|
||||
public abstract boolean getGenerateStructures();
|
||||
@@ -329,13 +329,15 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
|
||||
public abstract int l();
|
||||
|
||||
public abstract boolean m();
|
||||
|
||||
protected void a_(String s, int i) {
|
||||
this.d = s;
|
||||
this.e = i;
|
||||
h.info(s + ": " + i + "%");
|
||||
}
|
||||
|
||||
protected void m() {
|
||||
protected void n() {
|
||||
this.d = null;
|
||||
this.e = 0;
|
||||
|
||||
@@ -344,7 +346,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
|
||||
protected void saveChunks(boolean flag) throws ExceptionWorldConflict { // CraftBukkit - added throws
|
||||
if (!this.L) {
|
||||
// CraftBukkit start
|
||||
// CraftBukkit start - fire WorldSaveEvent
|
||||
// WorldServer[] aworldserver = this.worldServer;
|
||||
int i = this.worlds.size();
|
||||
|
||||
@@ -376,8 +378,8 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.ag() != null) {
|
||||
this.ag().b();
|
||||
if (this.ah() != null) {
|
||||
this.ah().b();
|
||||
}
|
||||
|
||||
if (this.t != null) {
|
||||
@@ -422,15 +424,15 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
public void run() {
|
||||
try {
|
||||
if (this.init()) {
|
||||
long i = ap();
|
||||
long i = aq();
|
||||
long j = 0L;
|
||||
|
||||
this.p.setMOTD(new ChatComponentText(this.motd));
|
||||
this.p.setServerInfo(new ServerPingServerData("1.7.2", 4));
|
||||
this.p.setServerInfo(new ServerPingServerData("1.7.5", 4));
|
||||
this.a(this.p);
|
||||
|
||||
while (this.isRunning) {
|
||||
long k = ap();
|
||||
long k = aq();
|
||||
long l = k - i;
|
||||
|
||||
if (l > 2000L && i - this.O >= 15000L) {
|
||||
@@ -448,17 +450,17 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
j += l;
|
||||
i = k;
|
||||
if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit
|
||||
this.t();
|
||||
this.u();
|
||||
j = 0L;
|
||||
} else {
|
||||
while (j > 50L) {
|
||||
MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||
j -= 50L;
|
||||
this.t();
|
||||
this.u();
|
||||
}
|
||||
}
|
||||
|
||||
Thread.sleep(1L);
|
||||
Thread.sleep(Math.max(1L, 50L - j));
|
||||
this.N = true;
|
||||
}
|
||||
} else {
|
||||
@@ -474,7 +476,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
crashreport = this.b(new CrashReport("Exception in server tick loop", throwable));
|
||||
}
|
||||
|
||||
File file1 = new File(new File(this.r(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt");
|
||||
File file1 = new File(new File(this.s(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt");
|
||||
|
||||
if (crashreport.a(file1)) {
|
||||
h.error("This crash report has been saved to: " + file1.getAbsolutePath());
|
||||
@@ -496,7 +498,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
} catch (Exception e) {
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.s();
|
||||
this.t();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -518,22 +520,23 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
serverping.setFavicon("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
|
||||
} catch (Exception exception) {
|
||||
h.error("Couldn\'t load server icon", exception);
|
||||
} finally {
|
||||
bytebuf.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected File r() {
|
||||
protected File s() {
|
||||
return new File(".");
|
||||
}
|
||||
|
||||
protected void a(CrashReport crashreport) {}
|
||||
|
||||
protected void s() {}
|
||||
protected void t() {}
|
||||
|
||||
protected void t() throws ExceptionWorldConflict { // CraftBukkit - added throws
|
||||
protected void u() throws ExceptionWorldConflict { // CraftBukkit - added throws
|
||||
long i = System.nanoTime();
|
||||
|
||||
AxisAlignedBB.a().a();
|
||||
++this.ticks;
|
||||
if (this.Q) {
|
||||
this.Q = false;
|
||||
@@ -542,12 +545,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
}
|
||||
|
||||
this.methodProfiler.a("root");
|
||||
this.u();
|
||||
this.v();
|
||||
if (i - this.T >= 5000000000L) {
|
||||
this.T = i;
|
||||
this.p.setPlayerSample(new ServerPingPlayerSample(this.C(), this.B()));
|
||||
GameProfile[] agameprofile = new GameProfile[Math.min(this.B(), 12)];
|
||||
int j = MathHelper.nextInt(this.q, 0, this.B() - agameprofile.length);
|
||||
this.p.setPlayerSample(new ServerPingPlayerSample(this.D(), this.C()));
|
||||
GameProfile[] agameprofile = new GameProfile[Math.min(this.C(), 12)];
|
||||
int j = MathHelper.nextInt(this.q, 0, this.C() - agameprofile.length);
|
||||
|
||||
for (int k = 0; k < agameprofile.length; ++k) {
|
||||
agameprofile[k] = ((EntityPlayer) this.t.players.get(j + k)).getProfile();
|
||||
@@ -580,7 +583,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
this.methodProfiler.b();
|
||||
}
|
||||
|
||||
public void u() {
|
||||
public void v() {
|
||||
this.methodProfiler.a("levels");
|
||||
|
||||
// CraftBukkit start
|
||||
@@ -611,7 +614,6 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
|
||||
this.methodProfiler.a(worldserver.getWorldData().getName());
|
||||
this.methodProfiler.a("pools");
|
||||
worldserver.getVec3DPool().a();
|
||||
this.methodProfiler.b();
|
||||
/* Drop global time updates
|
||||
if (this.ticks % 20 == 0) {
|
||||
@@ -652,7 +654,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
}
|
||||
|
||||
this.methodProfiler.c("connection");
|
||||
this.ag().c();
|
||||
this.ah().c();
|
||||
this.methodProfiler.c("players");
|
||||
this.t.tick();
|
||||
this.methodProfiler.c("tickables");
|
||||
@@ -745,7 +747,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
dedicatedserver.ay();
|
||||
dedicatedserver.az();
|
||||
}
|
||||
// */
|
||||
|
||||
@@ -774,12 +776,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
}
|
||||
}
|
||||
|
||||
public void w() {
|
||||
public void x() {
|
||||
// (new ThreadServerApplication(this, "Server thread")).start(); // CraftBukkit - prevent abuse
|
||||
}
|
||||
|
||||
public File d(String s) {
|
||||
return new File(this.r(), s);
|
||||
return new File(this.s(), s);
|
||||
}
|
||||
|
||||
public void info(String s) {
|
||||
@@ -802,27 +804,27 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public String x() {
|
||||
public String y() {
|
||||
return this.serverIp;
|
||||
}
|
||||
|
||||
public int y() {
|
||||
public int z() {
|
||||
return this.s;
|
||||
}
|
||||
|
||||
public String z() {
|
||||
public String A() {
|
||||
return this.motd;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return "1.7.2";
|
||||
}
|
||||
|
||||
public int B() {
|
||||
return this.t.getPlayerCount();
|
||||
return "1.7.5";
|
||||
}
|
||||
|
||||
public int C() {
|
||||
return this.t.getPlayerCount();
|
||||
}
|
||||
|
||||
public int D() {
|
||||
return this.t.getMaxPlayers();
|
||||
}
|
||||
|
||||
@@ -857,7 +859,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
// CraftBukkit start - fire RemoteServerCommandEvent
|
||||
public String g(final String s) { // final parameter
|
||||
Waitable<String> waitable = new Waitable<String>() {
|
||||
@Override
|
||||
@@ -981,11 +983,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
return this.n;
|
||||
}
|
||||
|
||||
public KeyPair I() {
|
||||
public KeyPair J() {
|
||||
return this.F;
|
||||
}
|
||||
|
||||
public int J() {
|
||||
public int K() {
|
||||
return this.s;
|
||||
}
|
||||
|
||||
@@ -993,7 +995,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
this.s = i;
|
||||
}
|
||||
|
||||
public String K() {
|
||||
public String L() {
|
||||
return this.G;
|
||||
}
|
||||
|
||||
@@ -1001,11 +1003,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
this.G = s;
|
||||
}
|
||||
|
||||
public boolean L() {
|
||||
public boolean M() {
|
||||
return this.G != null;
|
||||
}
|
||||
|
||||
public String M() {
|
||||
public String N() {
|
||||
return this.H;
|
||||
}
|
||||
|
||||
@@ -1018,7 +1020,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
}
|
||||
|
||||
public void a(EnumDifficulty enumdifficulty) {
|
||||
// CraftBukkit start
|
||||
// CraftBukkit start - Use worlds list for iteration
|
||||
for (int j = 0; j < this.worlds.size(); ++j) {
|
||||
WorldServer worldserver = this.worlds.get(j);
|
||||
// CraftBukkit end
|
||||
@@ -1027,7 +1029,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
if (worldserver.getWorldData().isHardcore()) {
|
||||
worldserver.difficulty = EnumDifficulty.HARD;
|
||||
worldserver.setSpawnFlags(true, true);
|
||||
} else if (this.L()) {
|
||||
} else if (this.M()) {
|
||||
worldserver.difficulty = enumdifficulty;
|
||||
worldserver.setSpawnFlags(worldserver.difficulty != EnumDifficulty.PEACEFUL, true);
|
||||
} else {
|
||||
@@ -1042,7 +1044,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean P() {
|
||||
public boolean Q() {
|
||||
return this.demoMode;
|
||||
}
|
||||
|
||||
@@ -1058,7 +1060,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
return this.convertable;
|
||||
}
|
||||
|
||||
public void S() {
|
||||
public void T() {
|
||||
this.L = true;
|
||||
this.getConvertable().d();
|
||||
|
||||
@@ -1087,16 +1089,16 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
public void a(MojangStatisticsGenerator mojangstatisticsgenerator) {
|
||||
mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(false));
|
||||
mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(0));
|
||||
mojangstatisticsgenerator.a("players_current", Integer.valueOf(this.B()));
|
||||
mojangstatisticsgenerator.a("players_max", Integer.valueOf(this.C()));
|
||||
mojangstatisticsgenerator.a("players_current", Integer.valueOf(this.C()));
|
||||
mojangstatisticsgenerator.a("players_max", Integer.valueOf(this.D()));
|
||||
mojangstatisticsgenerator.a("players_seen", Integer.valueOf(this.t.getSeenPlayers().length));
|
||||
mojangstatisticsgenerator.a("uses_auth", Boolean.valueOf(this.onlineMode));
|
||||
mojangstatisticsgenerator.a("gui_state", this.ai() ? "enabled" : "disabled");
|
||||
mojangstatisticsgenerator.a("run_time", Long.valueOf((ap() - mojangstatisticsgenerator.g()) / 60L * 1000L));
|
||||
mojangstatisticsgenerator.a("gui_state", this.aj() ? "enabled" : "disabled");
|
||||
mojangstatisticsgenerator.a("run_time", Long.valueOf((aq() - mojangstatisticsgenerator.g()) / 60L * 1000L));
|
||||
mojangstatisticsgenerator.a("avg_tick_ms", Integer.valueOf((int) (MathHelper.a(this.f) * 1.0E-6D)));
|
||||
int i = 0;
|
||||
|
||||
// CraftBukkit start
|
||||
// CraftBukkit start - use worlds list for iteration
|
||||
for (int j = 0; j < this.worlds.size(); ++j) {
|
||||
WorldServer worldserver = this.worlds.get(j);
|
||||
if (worldServer != null) {
|
||||
@@ -1110,7 +1112,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
mojangstatisticsgenerator.a("world[" + i + "][generator_name]", worlddata.getType().name());
|
||||
mojangstatisticsgenerator.a("world[" + i + "][generator_version]", Integer.valueOf(worlddata.getType().getVersion()));
|
||||
mojangstatisticsgenerator.a("world[" + i + "][height]", Integer.valueOf(this.D));
|
||||
mojangstatisticsgenerator.a("world[" + i + "][chunks_loaded]", Integer.valueOf(worldserver.K().getLoadedChunks()));
|
||||
mojangstatisticsgenerator.a("world[" + i + "][chunks_loaded]", Integer.valueOf(worldserver.L().getLoadedChunks()));
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@@ -1119,17 +1121,17 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
}
|
||||
|
||||
public void b(MojangStatisticsGenerator mojangstatisticsgenerator) {
|
||||
mojangstatisticsgenerator.a("singleplayer", Boolean.valueOf(this.L()));
|
||||
mojangstatisticsgenerator.a("server_brand", this.getServerModName());
|
||||
mojangstatisticsgenerator.a("gui_supported", GraphicsEnvironment.isHeadless() ? "headless" : "supported");
|
||||
mojangstatisticsgenerator.a("dedicated", Boolean.valueOf(this.V()));
|
||||
mojangstatisticsgenerator.b("singleplayer", Boolean.valueOf(this.M()));
|
||||
mojangstatisticsgenerator.b("server_brand", this.getServerModName());
|
||||
mojangstatisticsgenerator.b("gui_supported", GraphicsEnvironment.isHeadless() ? "headless" : "supported");
|
||||
mojangstatisticsgenerator.b("dedicated", Boolean.valueOf(this.W()));
|
||||
}
|
||||
|
||||
public boolean getSnooperEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract boolean V();
|
||||
public abstract boolean W();
|
||||
|
||||
public boolean getOnlineMode() {
|
||||
return this.server.getOnlineMode(); // CraftBukkit
|
||||
@@ -1202,28 +1204,28 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
}
|
||||
|
||||
public void a(EnumGamemode enumgamemode) {
|
||||
// CraftBukkit start
|
||||
// CraftBukkit start - use worlds list for iteration
|
||||
for (int i = 0; i < this.worlds.size(); ++i) {
|
||||
getServer().worlds.get(i).getWorldData().setGameType(enumgamemode);
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
public ServerConnection ag() {
|
||||
public ServerConnection ah() {
|
||||
return this.o;
|
||||
}
|
||||
|
||||
public boolean ai() {
|
||||
public boolean aj() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public abstract String a(EnumGamemode enumgamemode, boolean flag);
|
||||
|
||||
public int aj() {
|
||||
public int ak() {
|
||||
return this.ticks;
|
||||
}
|
||||
|
||||
public void ak() {
|
||||
public void al() {
|
||||
this.Q = true;
|
||||
}
|
||||
|
||||
@@ -1251,19 +1253,19 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
return this.R;
|
||||
}
|
||||
|
||||
public Proxy ao() {
|
||||
public Proxy ap() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public static long ap() {
|
||||
public static long aq() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public int aq() {
|
||||
public int getIdleTimeout() {
|
||||
return this.E;
|
||||
}
|
||||
|
||||
public void d(int i) {
|
||||
public void setIdleTimeout(int i) {
|
||||
this.E = i;
|
||||
}
|
||||
|
||||
@@ -1271,23 +1273,23 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
return new ChatComponentText(this.getName());
|
||||
}
|
||||
|
||||
public boolean ar() {
|
||||
public boolean as() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public MinecraftSessionService as() {
|
||||
public MinecraftSessionService at() {
|
||||
return this.S;
|
||||
}
|
||||
|
||||
public ServerPing at() {
|
||||
public ServerPing au() {
|
||||
return this.p;
|
||||
}
|
||||
|
||||
public void au() {
|
||||
public void av() {
|
||||
this.T = 0L;
|
||||
}
|
||||
|
||||
public static Logger av() {
|
||||
public static Logger getLogger() {
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user