Paper/CraftBukkit-Patches/0004-Spigot-Configuration.patch

101 lines
4.9 KiB
Diff

From 21486d9d244f3c22b6e8643c9495592493bcc1f9 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..e67f520 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
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