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
+ this.a((PlayerList) (new DedicatedPlayerList(this)));
+ org.spigotmc.SpigotConfig.init();
+ org.spigotmc.SpigotConfig.init((File) options.valueOf("spigot-settings"));
+ org.spigotmc.SpigotConfig.registerCommands();
+ // Spigot end
@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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) {
world.worldData.setDifficulty(difficulty);
world.setSpawnFlags(monsters, animals);
@ -94,6 +94,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*");
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
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
@ -121,7 +140,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+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"
+ + "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"
@ -139,8 +158,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ static Map<String, Command> commands;
+ /*========================================================================*/
+
+ public static void init()
+ public static void init(File configFile)
+ {
+ CONFIG_FILE = configFile;
+ config = new YamlConfiguration();
+ try
+ {
@ -315,4 +335,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) );
+ }
+}
--
--
1.9.0.msysgit.0

View File

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

View File

@ -31,4 +31,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ logCommands = getBoolean( "commands.log", true );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -48,4 +48,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ tabComplete = getInt( "commands.tab-complete", 0 );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -102,4 +102,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ outdatedServerMessage = transform( getString( "messages.outdated-server", outdatedServerMessage ) );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -313,4 +313,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
+}
--
--
1.9.0.msysgit.0

View File

@ -211,4 +211,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ bungee = getBoolean( "settings.bungeecord", false );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -52,4 +52,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ Bukkit.getLogger().log( Level.INFO, "Using {0} threads for Netty based IO", count );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -31,4 +31,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
System.out.println("Loading libraries, please wait...");
MinecraftServer.main(options);
} catch (Throwable t) {
--
--
1.9.0.msysgit.0

View File

@ -57,4 +57,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ lateBind = getBoolean( "settings.late-bind", false );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -88,4 +88,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -160,4 +160,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ + ( ( tps > 20.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 );
+ }
+}
--
--
1.9.0.msysgit.0

View File

@ -38,4 +38,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ System.out.println( "Server Ping Player Sample Count: " + playerSample );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -38,4 +38,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ playerShuffle = getInt( "settings.player-shuffle", 0 );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -56,4 +56,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } ) );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -32,4 +32,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ silentCommandBlocks = getBoolean( "commands.silent-commandblock-console", false );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -32,4 +32,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ filterCreativeItems = getBoolean( "settings.filter-creative-items", true );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -75,4 +75,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ Arrays.asList( "setblock", "summon", "testforblock", "tellraw" ) ) );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -32,4 +32,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ userCacheCap = getInt( "settings.user-cache-size", 1000 );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -51,4 +51,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ saveUserCacheOnStopOnly = getBoolean( "settings.save-user-cache-on-stop-only", false );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -57,4 +57,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ intCacheLimit = getInt( "settings.int-cache-limit", 1024 );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -33,4 +33,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ movedWronglyThreshold = getDouble( "settings.moved-wrongly-threshold", 0.0625D );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -33,4 +33,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ movedTooQuicklyThreshold = getDouble( "settings.moved-too-quickly-threshold", 100.0D );
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -70,4 +70,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ ( (AttributeRanged) GenericAttributes.ATTACK_DAMAGE ).b = attackDamage;
+ }
}
--
--
1.9.0.msysgit.0

View File

@ -62,4 +62,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
</Root>
</Loggers>
</Configuration>
--
--
1.9.0.msysgit.0