@@ -25,23 +25,18 @@
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.Random;
|
||||
@@ -33,10 +40,11 @@
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.FutureTask;
|
||||
-import javax.imageio.ImageIO;
|
||||
-import org.apache.commons.lang3.Validate;
|
||||
-import org.apache.logging.log4j.LogManager;
|
||||
-import org.apache.logging.log4j.Logger;
|
||||
@@ -39,6 +46,10 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.CraftServer;
|
||||
+
|
||||
+// CraftBukkit start
|
||||
+// CraftBukkit end
|
||||
|
||||
public abstract class MinecraftServer implements Runnable, ICommandListener, IAsyncTaskHandler, IMojangStatistics {
|
||||
|
||||
@@ -93,19 +101,61 @@
|
||||
public static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -94,19 +105,61 @@
|
||||
private Thread serverThread;
|
||||
private long aa = av();
|
||||
|
||||
@@ -106,7 +101,7 @@
|
||||
protected CommandDispatcher i() {
|
||||
return new CommandDispatcher(this);
|
||||
}
|
||||
@@ -143,6 +193,7 @@
|
||||
@@ -144,6 +197,7 @@
|
||||
this.a(s);
|
||||
this.b("menu.loadingLevel");
|
||||
this.worldServer = new WorldServer[3];
|
||||
@@ -114,7 +109,7 @@
|
||||
this.i = new long[this.worldServer.length][100];
|
||||
IDataManager idatamanager = this.convertable.a(s, true);
|
||||
|
||||
@@ -166,36 +217,107 @@
|
||||
@@ -167,36 +221,107 @@
|
||||
worlddata.a(s1);
|
||||
worldsettings = new WorldSettings(worlddata);
|
||||
}
|
||||
@@ -233,7 +228,7 @@
|
||||
this.v.setPlayerFileData(this.worldServer);
|
||||
this.a(this.getDifficulty());
|
||||
this.l();
|
||||
@@ -211,25 +333,38 @@
|
||||
@@ -212,25 +337,38 @@
|
||||
this.b("menu.generatingTerrain");
|
||||
byte b0 = 0;
|
||||
|
||||
@@ -287,7 +282,7 @@
|
||||
this.t();
|
||||
}
|
||||
|
||||
@@ -265,14 +400,17 @@
|
||||
@@ -266,14 +404,17 @@
|
||||
protected void t() {
|
||||
this.f = null;
|
||||
this.g = 0;
|
||||
@@ -307,7 +302,7 @@
|
||||
|
||||
if (worldserver != null) {
|
||||
if (!flag) {
|
||||
@@ -281,6 +419,7 @@
|
||||
@@ -282,6 +423,7 @@
|
||||
|
||||
try {
|
||||
worldserver.save(true, (IProgressUpdate) null);
|
||||
@@ -315,7 +310,7 @@
|
||||
} catch (ExceptionWorldConflict exceptionworldconflict) {
|
||||
MinecraftServer.LOGGER.warn(exceptionworldconflict.getMessage());
|
||||
}
|
||||
@@ -289,8 +428,24 @@
|
||||
@@ -290,8 +432,24 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -341,7 +336,7 @@
|
||||
if (this.am() != null) {
|
||||
this.am().b();
|
||||
}
|
||||
@@ -299,6 +454,7 @@
|
||||
@@ -300,6 +458,7 @@
|
||||
MinecraftServer.LOGGER.info("Saving players");
|
||||
this.v.savePlayers();
|
||||
this.v.u();
|
||||
@@ -349,7 +344,7 @@
|
||||
}
|
||||
|
||||
if (this.worldServer != null) {
|
||||
@@ -314,11 +470,13 @@
|
||||
@@ -315,11 +474,13 @@
|
||||
|
||||
this.saveChunks(false);
|
||||
|
||||
@@ -363,7 +358,7 @@
|
||||
}
|
||||
|
||||
if (this.m.d()) {
|
||||
@@ -358,6 +516,7 @@
|
||||
@@ -359,6 +520,7 @@
|
||||
long k = j - this.aa;
|
||||
|
||||
if (k > 2000L && this.aa - this.Q >= 15000L) {
|
||||
@@ -371,7 +366,7 @@
|
||||
MinecraftServer.LOGGER.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(k), Long.valueOf(k / 50L)});
|
||||
k = 2000L;
|
||||
this.Q = this.aa;
|
||||
@@ -370,11 +529,12 @@
|
||||
@@ -371,11 +533,12 @@
|
||||
|
||||
i += k;
|
||||
this.aa = j;
|
||||
@@ -385,7 +380,7 @@
|
||||
i -= 50L;
|
||||
this.C();
|
||||
}
|
||||
@@ -412,6 +572,12 @@
|
||||
@@ -413,6 +576,12 @@
|
||||
} catch (Throwable throwable1) {
|
||||
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
|
||||
} finally {
|
||||
@@ -398,7 +393,7 @@
|
||||
this.B();
|
||||
}
|
||||
|
||||
@@ -455,7 +621,7 @@
|
||||
@@ -456,7 +625,7 @@
|
||||
|
||||
protected void B() {}
|
||||
|
||||
@@ -407,7 +402,7 @@
|
||||
long i = System.nanoTime();
|
||||
|
||||
++this.ticks;
|
||||
@@ -481,7 +647,7 @@
|
||||
@@ -482,7 +651,7 @@
|
||||
this.q.b().a(agameprofile);
|
||||
}
|
||||
|
||||
@@ -416,7 +411,7 @@
|
||||
this.methodProfiler.a("save");
|
||||
this.v.savePlayers();
|
||||
this.saveChunks(true);
|
||||
@@ -516,20 +682,40 @@
|
||||
@@ -517,20 +686,40 @@
|
||||
|
||||
this.methodProfiler.c("levels");
|
||||
|
||||
@@ -460,7 +455,7 @@
|
||||
|
||||
this.methodProfiler.a("tick");
|
||||
|
||||
@@ -556,9 +742,9 @@
|
||||
@@ -557,9 +746,9 @@
|
||||
worldserver.getTracker().updatePlayers();
|
||||
this.methodProfiler.b();
|
||||
this.methodProfiler.b();
|
||||
@@ -472,7 +467,7 @@
|
||||
}
|
||||
|
||||
this.methodProfiler.c("connection");
|
||||
@@ -582,10 +768,11 @@
|
||||
@@ -583,10 +772,11 @@
|
||||
this.o.add(itickable);
|
||||
}
|
||||
|
||||
@@ -485,7 +480,7 @@
|
||||
boolean flag = true;
|
||||
String s = null;
|
||||
String s1 = ".";
|
||||
@@ -630,13 +817,16 @@
|
||||
@@ -631,13 +821,16 @@
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -503,7 +498,7 @@
|
||||
if (s != null) {
|
||||
dedicatedserver.i(s);
|
||||
}
|
||||
@@ -667,6 +857,25 @@
|
||||
@@ -668,6 +861,25 @@
|
||||
dedicatedserver.stop();
|
||||
}
|
||||
});
|
||||
@@ -529,7 +524,7 @@
|
||||
} catch (Exception exception) {
|
||||
MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception);
|
||||
}
|
||||
@@ -674,8 +883,10 @@
|
||||
@@ -675,8 +887,10 @@
|
||||
}
|
||||
|
||||
public void F() {
|
||||
@@ -540,7 +535,7 @@
|
||||
}
|
||||
|
||||
public File d(String s) {
|
||||
@@ -691,7 +902,14 @@
|
||||
@@ -692,7 +906,14 @@
|
||||
}
|
||||
|
||||
public WorldServer getWorldServer(int i) {
|
||||
@@ -556,7 +551,7 @@
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
@@ -715,7 +933,7 @@
|
||||
@@ -716,7 +937,7 @@
|
||||
}
|
||||
|
||||
public boolean isDebugging() {
|
||||
@@ -565,7 +560,7 @@
|
||||
}
|
||||
|
||||
public void g(String s) {
|
||||
@@ -730,7 +948,7 @@
|
||||
@@ -731,7 +952,7 @@
|
||||
}
|
||||
|
||||
public String getServerModName() {
|
||||
@@ -574,15 +569,15 @@
|
||||
}
|
||||
|
||||
public CrashReport b(CrashReport crashreport) {
|
||||
@@ -759,6 +977,7 @@
|
||||
@@ -760,6 +981,7 @@
|
||||
}
|
||||
|
||||
public List<String> tabCompleteCommand(ICommandListener icommandlistener, String s, BlockPosition blockposition, boolean flag) {
|
||||
public List<String> tabCompleteCommand(ICommandListener icommandlistener, String s, @Nullable BlockPosition blockposition, boolean flag) {
|
||||
+ /* CraftBukkit start - Allow tab-completion of Bukkit commands
|
||||
ArrayList arraylist = Lists.newArrayList();
|
||||
boolean flag1 = s.startsWith("/");
|
||||
|
||||
@@ -801,10 +1020,13 @@
|
||||
@@ -802,10 +1024,13 @@
|
||||
|
||||
return arraylist;
|
||||
}
|
||||
@@ -597,7 +592,7 @@
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -860,8 +1082,10 @@
|
||||
@@ -861,8 +1086,10 @@
|
||||
}
|
||||
|
||||
public void a(EnumDifficulty enumdifficulty) {
|
||||
@@ -610,7 +605,7 @@
|
||||
|
||||
if (worldserver != null) {
|
||||
if (worldserver.getWorldData().isHardcore()) {
|
||||
@@ -928,9 +1152,11 @@
|
||||
@@ -929,9 +1156,11 @@
|
||||
int i = 0;
|
||||
|
||||
if (this.worldServer != null) {
|
||||
@@ -625,7 +620,7 @@
|
||||
WorldData worlddata = worldserver.getWorldData();
|
||||
|
||||
mojangstatisticsgenerator.a("world[" + i + "][dimension]", Integer.valueOf(worldserver.worldProvider.getDimensionManager().getDimensionID()));
|
||||
@@ -963,7 +1189,7 @@
|
||||
@@ -964,7 +1193,7 @@
|
||||
public abstract boolean aa();
|
||||
|
||||
public boolean getOnlineMode() {
|
||||
@@ -634,7 +629,7 @@
|
||||
}
|
||||
|
||||
public void setOnlineMode(boolean flag) {
|
||||
@@ -1035,8 +1261,9 @@
|
||||
@@ -1036,8 +1265,9 @@
|
||||
}
|
||||
|
||||
public void setGamemode(WorldSettings.EnumGamemode worldsettings_enumgamemode) {
|
||||
@@ -646,7 +641,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1068,7 +1295,7 @@
|
||||
@@ -1069,7 +1299,7 @@
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
@@ -655,7 +650,7 @@
|
||||
}
|
||||
|
||||
public Entity f() {
|
||||
@@ -1139,8 +1366,10 @@
|
||||
@@ -1141,8 +1371,10 @@
|
||||
WorldServer[] aworldserver = this.worldServer;
|
||||
int i = aworldserver.length;
|
||||
|
||||
@@ -668,7 +663,7 @@
|
||||
|
||||
if (worldserver != null) {
|
||||
Entity entity = worldserver.getEntity(uuid);
|
||||
@@ -1155,7 +1384,7 @@
|
||||
@@ -1157,7 +1389,7 @@
|
||||
}
|
||||
|
||||
public boolean getSendCommandFeedback() {
|
||||
@@ -677,7 +672,7 @@
|
||||
}
|
||||
|
||||
public void a(CommandObjectiveExecutor.EnumCommandResult commandobjectiveexecutor_enumcommandresult, int i) {}
|
||||
@@ -1170,7 +1399,7 @@
|
||||
@@ -1172,7 +1404,7 @@
|
||||
|
||||
public <V> ListenableFuture<V> a(Callable<V> callable) {
|
||||
Validate.notNull(callable);
|
||||
@@ -686,8 +681,8 @@
|
||||
ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callable);
|
||||
Queue queue = this.j;
|
||||
|
||||
@@ -1215,4 +1444,11 @@
|
||||
public int a(WorldServer worldserver) {
|
||||
@@ -1217,4 +1449,11 @@
|
||||
public int a(@Nullable WorldServer worldserver) {
|
||||
return worldserver != null ? worldserver.getGameRules().c("spawnRadius") : 10;
|
||||
}
|
||||
+
|
||||
|
||||
Reference in New Issue
Block a user