summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/DedicatedServer.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft/server/DedicatedServer.java')
-rw-r--r--src/main/java/net/minecraft/server/DedicatedServer.java260
1 files changed, 129 insertions, 131 deletions
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index f1caa385..83f2dad5 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -28,9 +28,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
private RemoteStatusListener k;
private RemoteControlListener l;
public PropertyManager propertyManager; // CraftBukkit - private -> public
+ private EULA n;
private boolean generateStructures;
- private EnumGamemode o;
- private boolean p;
+ private EnumGamemode p;
+ private boolean q;
// CraftBukkit start - Signature changed
public DedicatedServer(joptsimple.OptionSet options) {
@@ -67,147 +68,154 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true));
// CraftBukkit end
- i.info("Starting minecraft server version 1.7.9");
+ i.info("Starting minecraft server version 1.7.10");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
i.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}
i.info("Loading properties");
this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
- if (this.N()) {
- this.c("127.0.0.1");
+ this.n = new EULA(new File("eula.txt"));
+ if (!this.n.a()) {
+ i.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
+ this.n.b();
+ return false;
} else {
- this.setOnlineMode(this.propertyManager.getBoolean("online-mode", true));
- this.c(this.propertyManager.getString("server-ip", ""));
- }
+ if (this.N()) {
+ this.c("127.0.0.1");
+ } else {
+ this.setOnlineMode(this.propertyManager.getBoolean("online-mode", true));
+ this.c(this.propertyManager.getString("server-ip", ""));
+ }
- this.setSpawnAnimals(this.propertyManager.getBoolean("spawn-animals", true));
- this.setSpawnNPCs(this.propertyManager.getBoolean("spawn-npcs", true));
- this.setPvP(this.propertyManager.getBoolean("pvp", true));
- this.setAllowFlight(this.propertyManager.getBoolean("allow-flight", false));
- this.setTexturePack(this.propertyManager.getString("resource-pack", ""));
- this.setMotd(this.propertyManager.getString("motd", "A Minecraft Server"));
- this.setForceGamemode(this.propertyManager.getBoolean("force-gamemode", false));
- this.setIdleTimeout(this.propertyManager.getInt("player-idle-timeout", 0));
- if (this.propertyManager.getInt("difficulty", 1) < 0) {
- this.propertyManager.a("difficulty", Integer.valueOf(0));
- } else if (this.propertyManager.getInt("difficulty", 1) > 3) {
- this.propertyManager.a("difficulty", Integer.valueOf(3));
- }
+ this.setSpawnAnimals(this.propertyManager.getBoolean("spawn-animals", true));
+ this.setSpawnNPCs(this.propertyManager.getBoolean("spawn-npcs", true));
+ this.setPvP(this.propertyManager.getBoolean("pvp", true));
+ this.setAllowFlight(this.propertyManager.getBoolean("allow-flight", false));
+ this.setTexturePack(this.propertyManager.getString("resource-pack", ""));
+ this.setMotd(this.propertyManager.getString("motd", "A Minecraft Server"));
+ this.setForceGamemode(this.propertyManager.getBoolean("force-gamemode", false));
+ this.setIdleTimeout(this.propertyManager.getInt("player-idle-timeout", 0));
+ if (this.propertyManager.getInt("difficulty", 1) < 0) {
+ this.propertyManager.setProperty("difficulty", Integer.valueOf(0));
+ } else if (this.propertyManager.getInt("difficulty", 1) > 3) {
+ this.propertyManager.setProperty("difficulty", Integer.valueOf(3));
+ }
- this.generateStructures = this.propertyManager.getBoolean("generate-structures", true);
- int gamemode = this.propertyManager.getInt("gamemode", EnumGamemode.SURVIVAL.a()); // CraftBukkit - Unique name to avoid stomping on logger
+ this.generateStructures = this.propertyManager.getBoolean("generate-structures", true);
+ int gamemode = this.propertyManager.getInt("gamemode", EnumGamemode.SURVIVAL.getId()); // CraftBukkit - Unique name to avoid stomping on logger
- this.o = WorldSettings.a(gamemode); // CraftBukkit - Use new name
- i.info("Default game type: " + this.o);
- InetAddress inetaddress = null;
+ this.p = WorldSettings.a(gamemode); // CraftBukkit - Use new name
+ i.info("Default game type: " + this.p);
+ InetAddress inetaddress = null;
- if (this.getServerIp().length() > 0) {
- inetaddress = InetAddress.getByName(this.getServerIp());
- }
+ if (this.getServerIp().length() > 0) {
+ inetaddress = InetAddress.getByName(this.getServerIp());
+ }
- if (this.L() < 0) {
- this.setPort(this.propertyManager.getInt("server-port", 25565));
- }
+ if (this.L() < 0) {
+ this.setPort(this.propertyManager.getInt("server-port", 25565));
+ }
- i.info("Generating keypair");
- this.a(MinecraftEncryption.b());
- i.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.L());
+ i.info("Generating keypair");
+ this.a(MinecraftEncryption.b());
+ i.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.L());
- try {
- this.ai().a(inetaddress, this.L());
- } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
- i.warn("**** FAILED TO BIND TO PORT!");
- i.warn("The exception was: {}", new Object[] { ioexception.toString()});
- i.warn("Perhaps a server is already running on that port?");
- return false;
- }
+ try {
+ this.ai().a(inetaddress, this.L());
+ } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
+ i.warn("**** FAILED TO BIND TO PORT!");
+ i.warn("The exception was: {}", new Object[] { ioexception.toString()});
+ i.warn("Perhaps a server is already running on that port?");
+ return false;
+ }
- this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit
+ this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit
- if (!this.getOnlineMode()) {
- i.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
- i.warn("The server will make no attempt to authenticate usernames. Beware.");
- i.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
- i.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
- }
+ if (!this.getOnlineMode()) {
+ i.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
+ i.warn("The server will make no attempt to authenticate usernames. Beware.");
+ i.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
+ i.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
+ }
- if (this.aE()) {
- this.getUserCache().c();
- }
+ if (this.aE()) {
+ this.getUserCache().c();
+ }
- if (!NameReferencingFileConverter.a(this.propertyManager)) {
- return false;
- } else {
- // this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit - moved up
- this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved from MinecraftServer constructor
- long j = System.nanoTime();
+ if (!NameReferencingFileConverter.a(this.propertyManager)) {
+ return false;
+ } else {
+ // this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit - moved up
+ this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved from MinecraftServer constructor
+ long j = System.nanoTime();
- if (this.O() == null) {
- this.k(this.propertyManager.getString("level-name", "world"));
- }
+ if (this.O() == null) {
+ this.k(this.propertyManager.getString("level-name", "world"));
+ }
- String s = this.propertyManager.getString("level-seed", "");
- String s1 = this.propertyManager.getString("level-type", "DEFAULT");
- String s2 = this.propertyManager.getString("generator-settings", "");
- long k = (new Random()).nextLong();
+ String s = this.propertyManager.getString("level-seed", "");
+ String s1 = this.propertyManager.getString("level-type", "DEFAULT");
+ String s2 = this.propertyManager.getString("generator-settings", "");
+ long k = (new Random()).nextLong();
- if (s.length() > 0) {
- try {
- long l = Long.parseLong(s);
+ if (s.length() > 0) {
+ try {
+ long l = Long.parseLong(s);
- if (l != 0L) {
- k = l;
+ if (l != 0L) {
+ k = l;
+ }
+ } catch (NumberFormatException numberformatexception) {
+ k = (long) s.hashCode();
}
- } catch (NumberFormatException numberformatexception) {
- k = (long) s.hashCode();
}
- }
- WorldType worldtype = WorldType.getType(s1);
+ WorldType worldtype = WorldType.getType(s1);
- if (worldtype == null) {
- worldtype = WorldType.NORMAL;
- }
+ if (worldtype == null) {
+ worldtype = WorldType.NORMAL;
+ }
- this.at();
- this.getEnableCommandBlock();
- this.l();
- this.getSnooperEnabled();
- this.c(this.propertyManager.getInt("max-build-height", 256));
- this.c((this.getMaxBuildHeight() + 8) / 16 * 16);
- this.c(MathHelper.a(this.getMaxBuildHeight(), 64, 256));
- this.propertyManager.a("max-build-height", Integer.valueOf(this.getMaxBuildHeight()));
- i.info("Preparing level \"" + this.O() + "\"");
- this.a(this.O(), this.O(), k, worldtype, s2);
- long i1 = System.nanoTime() - j;
- String s3 = String.format("%.3fs", new Object[] { Double.valueOf((double) i1 / 1.0E9D)});
-
- i.info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
- if (this.propertyManager.getBoolean("enable-query", false)) {
- i.info("Starting GS4 status listener");
- this.k = new RemoteStatusListener(this);
- this.k.a();
- }
+ this.at();
+ this.getEnableCommandBlock();
+ this.l();
+ this.getSnooperEnabled();
+ this.c(this.propertyManager.getInt("max-build-height", 256));
+ this.c((this.getMaxBuildHeight() + 8) / 16 * 16);
+ this.c(MathHelper.a(this.getMaxBuildHeight(), 64, 256));
+ this.propertyManager.setProperty("max-build-height", Integer.valueOf(this.getMaxBuildHeight()));
+ i.info("Preparing level \"" + this.O() + "\"");
+ this.a(this.O(), this.O(), k, worldtype, s2);
+ long i1 = System.nanoTime() - j;
+ String s3 = String.format("%.3fs", new Object[] { Double.valueOf((double) i1 / 1.0E9D)});
+
+ i.info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
+ if (this.propertyManager.getBoolean("enable-query", false)) {
+ i.info("Starting GS4 status listener");
+ this.k = new RemoteStatusListener(this);
+ this.k.a();
+ }
- if (this.propertyManager.getBoolean("enable-rcon", false)) {
- i.info("Starting remote control listener");
- this.l = new RemoteControlListener(this);
- this.l.a();
- this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit
- }
+ if (this.propertyManager.getBoolean("enable-rcon", false)) {
+ i.info("Starting remote control listener");
+ this.l = new RemoteControlListener(this);
+ this.l.a();
+ this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit
+ }
- // CraftBukkit start
- if (this.server.getBukkitSpawnRadius() > -1) {
- i.info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you.");
- this.propertyManager.properties.remove("spawn-protection");
- this.propertyManager.getInt("spawn-protection", this.server.getBukkitSpawnRadius());
- this.server.removeBukkitSpawnRadius();
- this.propertyManager.savePropertiesFile();
- }
- // CraftBukkit end
+ // CraftBukkit start
+ if (this.server.getBukkitSpawnRadius() > -1) {
+ i.info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you.");
+ this.propertyManager.properties.remove("spawn-protection");
+ this.propertyManager.getInt("spawn-protection", this.server.getBukkitSpawnRadius());
+ this.server.removeBukkitSpawnRadius();
+ this.propertyManager.savePropertiesFile();
+ }
+ // CraftBukkit end
- return true;
+ return true;
+ }
}
}
@@ -222,28 +230,18 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public EnumGamemode getGamemode() {
- return this.o;
+ return this.p;
}
public EnumDifficulty getDifficulty() {
- return EnumDifficulty.a(this.propertyManager.getInt("difficulty", 1));
+ return EnumDifficulty.getById(this.propertyManager.getInt("difficulty", 1));
}
public boolean isHardcore() {
return this.propertyManager.getBoolean("hardcore", false);
}
- protected void a(CrashReport crashreport) {
- while (this.isRunning()) {
- this.aB();
-
- try {
- Thread.sleep(10L);
- } catch (InterruptedException interruptedexception) {
- ;
- }
- }
- }
+ protected void a(CrashReport crashreport) {}
public CrashReport b(CrashReport crashreport) {
crashreport = super.b(crashreport);
@@ -319,7 +317,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public void a(String s, Object object) {
- this.propertyManager.a(s, object);
+ this.propertyManager.setProperty(s, object);
}
public void a() {
@@ -334,11 +332,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
public void aD() {
ServerGUI.a(this);
- this.p = true;
+ this.q = true;
}
public boolean ak() {
- return this.p;
+ return this.q;
}
public String a(EnumGamemode enumgamemode, boolean flag) {
@@ -356,7 +354,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
if (world.worldProvider.dimension != 0) {
return false;
- } else if (this.aC().getOPs().d()) {
+ } else if (this.aC().getOPs().isEmpty()) {
return false;
} else if (this.aC().isOp(entityhuman.getProfile())) {
return false;
@@ -378,7 +376,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
public void setIdleTimeout(int i) {
super.setIdleTimeout(i);
- this.propertyManager.a("player-idle-timeout", Integer.valueOf(i));
+ this.propertyManager.setProperty("player-idle-timeout", Integer.valueOf(i));
this.a();
}