summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/net/minecraft/server/MinecraftServer.java9
-rw-r--r--src/main/java/net/minecraft/server/NetServerHandler.java2
-rw-r--r--src/main/java/net/minecraft/server/PropertyManager.java2
-rw-r--r--src/main/java/net/minecraft/server/WorldServer.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftServer.java11
-rw-r--r--src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java3
6 files changed, 22 insertions, 7 deletions
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index eaee7e23..8df7fb45 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -50,7 +50,6 @@ public class MinecraftServer implements Runnable, ICommandListener {
public boolean o;
// CraftBukkit start
- public int spawnProtection;
public List<WorldServer> worlds = new ArrayList<WorldServer>();
public CraftServer server;
public OptionSet options;
@@ -100,7 +99,6 @@ public class MinecraftServer implements Runnable, ICommandListener {
this.spawnAnimals = this.propertyManager.getBoolean("spawn-animals", true);
this.pvpMode = this.propertyManager.getBoolean("pvp", true);
this.o = this.propertyManager.getBoolean("allow-flight", false);
- this.spawnProtection = this.propertyManager.getInt("spawn-protection", 16); // CraftBukkit - Configurable spawn protection start
InetAddress inetaddress = null;
if (s.length() > 0) {
@@ -149,8 +147,13 @@ public class MinecraftServer implements Runnable, ICommandListener {
long elapsed = System.nanoTime() - j;
String time = String.format("%.3fs", elapsed / 10000000000.0D);
log.info("Done (" + time + ")! For help, type \"help\" or \"?\"");
- // CraftBukkit end
+ if (this.propertyManager.properties.containsKey("spawn-protection")) {
+ log.info("'spawn-protection' in server.properties has been moved to 'settings.spawn-radius' in bukkit.yml. I will move your config for you.");
+ server.setSpawnRadius(this.propertyManager.getInt("spawn-protection", 16));
+ this.propertyManager.properties.remove("spawn-protection");
+ this.propertyManager.b();
+ }
return true;
}
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java
index 0e2fb265..052a2b80 100644
--- a/src/main/java/net/minecraft/server/NetServerHandler.java
+++ b/src/main/java/net/minecraft/server/NetServerHandler.java
@@ -448,7 +448,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (packet14blockdig.e == 0) {
// CraftBukkit
- if (i1 < this.minecraftServer.spawnProtection && !flag) {
+ if (i1 < server.getSpawnRadius() && !flag) {
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
} else {
// CraftBukkit - add face argument
diff --git a/src/main/java/net/minecraft/server/PropertyManager.java b/src/main/java/net/minecraft/server/PropertyManager.java
index ec7da391..91af75ee 100644
--- a/src/main/java/net/minecraft/server/PropertyManager.java
+++ b/src/main/java/net/minecraft/server/PropertyManager.java
@@ -12,7 +12,7 @@ import joptsimple.OptionSet; // CraftBukkit
public class PropertyManager {
public static Logger a = Logger.getLogger("Minecraft");
- private Properties properties = new Properties();
+ public Properties properties = new Properties(); // Craftbukkit - priv to pub
private File c;
public PropertyManager(File file1) {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 15ffd557..56c8c0bf 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -99,7 +99,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
}
// CraftBukkit - Configurable spawn protection
- return i1 > this.server.spawnProtection || this.server.serverConfigurationManager.isOp(entityhuman.name);
+ return i1 > getServer().getSpawnRadius() || this.server.serverConfigurationManager.isOp(entityhuman.name);
}
protected void c(Entity entity) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6d4232de..2ac7c59a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -95,7 +95,9 @@ public final class CraftServer implements Server {
configuration.getString("database.password", "walrus");
configuration.getString("database.driver", "org.sqlite.JDBC");
configuration.getString("database.isolation", "SERIALIZABLE");
+
configuration.getString("settings.update-folder", "update");
+ configuration.getInt("settings.spawn-radius", 16);
if (configuration.getNode("aliases") == null) {
configuration.setProperty("aliases.icanhasbukkit", "version");
@@ -553,4 +555,13 @@ public final class CraftServer implements Server {
return result;
}
+
+ public int getSpawnRadius() {
+ return configuration.getInt("settings.spawn-radius", 16);
+ }
+
+ public void setSpawnRadius(int value) {
+ configuration.setProperty("settings.spawn-radius", value);
+ configuration.save();
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 6074d072..474cd3f4 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -23,6 +23,7 @@ import net.minecraft.server.Item;
import net.minecraft.server.ItemStack;
import net.minecraft.server.World;
import net.minecraft.server.WorldServer;
+import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -50,7 +51,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
public class CraftEventFactory {
private static boolean canBuild(CraftWorld world, Player player, int x, int z) {
WorldServer worldServer = world.getHandle();
- int spawnSize = worldServer.server.spawnProtection;
+ int spawnSize = Bukkit.getServer().getSpawnRadius();
if (spawnSize <= 0) return true;
if (player.isOp()) return true;