Allow specifying location of spigot.yml

As requested here: http://www.spigotmc.org/threads/specify-location-of-spigot-yml.67747/
This commit is contained in:
Ginger Geek 2015-05-25 20:09:58 +01:00
parent dd2580a742
commit 8050f01466
25 changed files with 100 additions and 30 deletions

View File

@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
+ // Spigot start + // Spigot start
+ this.a((PlayerList) (new DedicatedPlayerList(this))); + this.a((PlayerList) (new DedicatedPlayerList(this)));
+ org.spigotmc.SpigotConfig.init(); + org.spigotmc.SpigotConfig.init((File) options.valueOf("spigot-settings"));
+ org.spigotmc.SpigotConfig.registerCommands(); + org.spigotmc.SpigotConfig.registerCommands();
+ // Spigot end + // Spigot end
@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
logger.log(Level.WARNING, "Failed to load banned-players.json, " + ex.getMessage()); logger.log(Level.WARNING, "Failed to load banned-players.json, " + ex.getMessage());
} }
+ org.spigotmc.SpigotConfig.init(); // Spigot + org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
for (WorldServer world : console.worlds) { for (WorldServer world : console.worlds) {
world.worldData.setDifficulty(difficulty); world.worldData.setDifficulty(difficulty);
world.setSpawnFlags(monsters, animals); world.setSpawnFlags(monsters, animals);
@ -94,6 +94,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*"); overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*");
int pollCount = 0; int pollCount = 0;
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -0,0 +0,0 @@ public class Main {
acceptsAll(asList("v", "version"), "Show the CraftBukkit Version");
acceptsAll(asList("demo"), "Demo mode");
+
+ // Spigot Start
+ acceptsAll(asList("S", "spigot-settings"), "File for spigot settings")
+ .withRequiredArg()
+ .ofType(File.class)
+ .defaultsTo(new File("spigot.yml"))
+ .describedAs("Yml file");
+ // Spigot End
}
};
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
@ -121,7 +140,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+public class SpigotConfig +public class SpigotConfig
+{ +{
+ +
+ private static final File CONFIG_FILE = new File( "spigot.yml" ); + private static File CONFIG_FILE;
+ private static final String HEADER = "This is the main configuration file for Spigot.\n" + private static final String HEADER = "This is the main configuration file for Spigot.\n"
+ + "As you can see, there's tons to configure. Some options may impact gameplay, so use\n" + + "As you can see, there's tons to configure. Some options may impact gameplay, so use\n"
+ + "with caution, and make sure you know what each option does before configuring.\n" + + "with caution, and make sure you know what each option does before configuring.\n"
@ -139,8 +158,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ static Map<String, Command> commands; + static Map<String, Command> commands;
+ /*========================================================================*/ + /*========================================================================*/
+ +
+ public static void init() + public static void init(File configFile)
+ { + {
+ CONFIG_FILE = configFile;
+ config = new YamlConfiguration(); + config = new YamlConfiguration();
+ try + try
+ { + {
@ -316,3 +336,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+} +}
-- --
1.9.0.msysgit.0

View File

@ -665,7 +665,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/*========================================================================*/ /*========================================================================*/
+ private static Metrics metrics; + private static Metrics metrics;
public static void init() public static void init(File configFile)
{ {
@@ -0,0 +0,0 @@ public class SpigotConfig @@ -0,0 +0,0 @@ public class SpigotConfig
{ {
@ -687,3 +687,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
static void readConfig(Class<?> clazz, Object instance) static void readConfig(Class<?> clazz, Object instance)
-- --
1.9.0.msysgit.0

View File

@ -32,3 +32,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -49,3 +49,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -103,3 +103,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -314,3 +314,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+} +}
-- --
1.9.0.msysgit.0

View File

@ -212,3 +212,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -53,3 +53,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -32,3 +32,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
MinecraftServer.main(options); MinecraftServer.main(options);
} catch (Throwable t) { } catch (Throwable t) {
-- --
1.9.0.msysgit.0

View File

@ -58,3 +58,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -89,3 +89,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -161,3 +161,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+} +}
-- --
1.9.0.msysgit.0

View File

@ -39,3 +39,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -39,3 +39,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -57,3 +57,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -33,3 +33,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -33,3 +33,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -76,3 +76,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -33,3 +33,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -52,3 +52,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -58,3 +58,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -34,3 +34,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -34,3 +34,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -71,3 +71,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
} }
-- --
1.9.0.msysgit.0

View File

@ -63,3 +63,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
</Loggers> </Loggers>
</Configuration> </Configuration>
-- --
1.9.0.msysgit.0