Skip to content

Commit df77372

Browse files
committed
Configurable server.properties file location
1 parent 039af3c commit df77372

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/main/java/org/mvplugins/multiverse/core/config/CoreConfig.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,14 @@ public String getBukkitYmlPath() {
623623
return configHandle.get(configNodes.bukkitYmlPath);
624624
}
625625

626+
public Try<Void> setServerPropertiesPath(String serverPropertiesPath) {
627+
return configHandle.set(configNodes.serverPropertiesPath, serverPropertiesPath);
628+
}
629+
630+
public String getServerPropertiesPath() {
631+
return configHandle.get(configNodes.serverPropertiesPath);
632+
}
633+
626634
/**
627635
* {@inheritDoc}
628636
*/

src/main/java/org/mvplugins/multiverse/core/config/CoreConfigNodes.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,13 @@ private <N extends Node> N node(N node) {
512512
.name("bukkit-yml-path")
513513
.build());
514514

515+
final ConfigNode<String> serverPropertiesPath = node(ConfigNode.builder("misc.server-properties-path", String.class)
516+
.comment("Change this if you use a custom path for the server.properties file with `--config` startup flag.")
517+
.comment("Note: this config option needs a server restart to take effect.")
518+
.defaultValue("server.properties")
519+
.name("server-properties-path")
520+
.build());
521+
515522
final ConfigNode<Integer> globalDebug = node(ConfigNode.builder("misc.global-debug", Integer.class)
516523
.comment("")
517524
.comment("This is our debug flag to help identify issues with Multiverse.")

src/main/java/org/mvplugins/multiverse/core/utils/FileUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public File getServerFolder() {
7777
*/
7878
public @Nullable File getServerProperties() {
7979
if (this.serverProperties == null) {
80-
this.serverProperties = findFileFromServerDirectory("server.properties");
80+
this.serverProperties = findFileFromServerDirectory(config.getServerPropertiesPath());
8181
Logging.finer("server.properties: %s", this.serverProperties);
8282
}
8383
return this.serverProperties;

0 commit comments

Comments
 (0)