PaperSpigot-Parent/CraftBukkit-Patches/0004-Spigot-Configuration.patch
2013-06-15 22:01:15 +10:00

110 lines
5.4 KiB
Diff

From 5e6688239dff8fcd5dc6187df2d622baa32cf284 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 14 May 2013 12:06:27 +1000
Subject: [PATCH] Spigot Configuration
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 7261dc9..10ce69d 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -55,6 +55,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.getLogger().info("Loading properties");
this.propertyManager = new PropertyManager(this.options, this.getLogger()); // CraftBukkit - CLI argument support
+ this.a((PlayerList) (new DedicatedPlayerList(this))); // Spigot - moved up from below
if (this.I()) {
this.d("127.0.0.1");
} else {
@@ -103,7 +104,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return false;
}
- this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit
+ // this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit // Spigot - moved to top of method
if (!this.getOnlineMode()) {
this.getLogger().warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 3a4ddea..18dc536 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -111,7 +111,7 @@ public abstract class World implements IBlockAccess {
// Changed signature
public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, IConsoleLogManager iconsolelogmanager, ChunkGenerator gen, org.bukkit.World.Environment env) {
this.generator = gen;
- this.world = new CraftWorld((WorldServer) this, gen, env);
+ this.world = new CraftWorld((WorldServer) this, gen, env, s); // Spigot
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
// CraftBukkit end
@@ -123,7 +123,7 @@ public abstract class World implements IBlockAccess {
this.methodProfiler = methodprofiler;
this.worldMaps = new WorldMapCollection(idatamanager);
this.logAgent = iconsolelogmanager;
- this.worldData = idatamanager.getWorldData();
+ // this.worldData = idatamanager.getWorldData();
if (worldprovider != null) {
this.worldProvider = worldprovider;
} else if (this.worldData != null && this.worldData.j() != 0) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6cb50b7..2956e75 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -145,7 +145,7 @@ public final class CraftServer implements Server {
protected final MinecraftServer console;
protected final DedicatedPlayerList playerList;
private final Map<String, World> worlds = new LinkedHashMap<String, World>();
- private YamlConfiguration configuration;
+ public YamlConfiguration configuration; // Spigot
private final Yaml yaml = new Yaml(new SafeConstructor());
private final Map<String, OfflinePlayer> offlinePlayers = new MapMaker().softValues().makeMap();
private final AutoUpdater updater;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index c0fb528..e6fdbe5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -67,8 +67,14 @@ public class CraftWorld implements World {
private int chunkGCTickCount;
private static final Random rand = new Random();
-
+
+ // Spigot start
public CraftWorld(WorldServer world, ChunkGenerator gen, Environment env) {
+ this( world, gen, env, "default" );
+ }
+
+ public CraftWorld(WorldServer world, ChunkGenerator gen, Environment env, String name) {
+ // Spigot end
this.world = world;
this.generator = gen;
@@ -77,6 +83,23 @@ public class CraftWorld implements World {
if (server.chunkGCPeriod > 0) {
chunkGCTickCount = rand.nextInt(server.chunkGCPeriod);
}
+ // Spigot start
+ org.bukkit.configuration.file.YamlConfiguration configuration = server.configuration;
+ name = name.replaceAll( " ", "_" );
+
+ // Load defaults first
+ boolean info = configuration.getBoolean( "world-settings.default.info", true );
+
+ // Override defaults with world specific, if they exist
+ info = configuration.getBoolean( "world-settings." + name + ".info", info );
+
+ if ( info )
+ {
+ server.getLogger().info( "-------------- Spigot ----------------" );
+ server.getLogger().info( "-------- World Settings For [" + name + "] --------" );
+ server.getLogger().info( "-------------------------------------------------" );
+ }
+ // Spigot end
}
public Block getBlockAt(int x, int y, int z) {
--
1.8.1.2