Skip to content

Commit a9cc577

Browse files
authored
Merge pull request #3330 from ElFrod0/config-server-properties-path
Configurable server.properties path
2 parents 039af3c + 02344a3 commit a9cc577

4 files changed

Lines changed: 20 additions & 1 deletion

File tree

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

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

626+
@ApiStatus.AvailableSince("5.3")
627+
public Try<Void> setServerPropertiesPath(String serverPropertiesPath) {
628+
return configHandle.set(configNodes.serverPropertiesPath, serverPropertiesPath);
629+
}
630+
631+
@ApiStatus.AvailableSince("5.3")
632+
public String getServerPropertiesPath() {
633+
return configHandle.get(configNodes.serverPropertiesPath);
634+
}
635+
626636
/**
627637
* {@inheritDoc}
628638
*/

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,14 @@ 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("")
517+
.comment("Change this if you use a custom path for the server.properties file with `--config` startup flag.")
518+
.comment("Note: this config option needs a server restart to take effect.")
519+
.defaultValue("server.properties")
520+
.name("server-properties-path")
521+
.build());
522+
515523
final ConfigNode<Integer> globalDebug = node(ConfigNode.builder("misc.global-debug", Integer.class)
516524
.comment("")
517525
.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;

src/test/resources/configs/fresh_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ event-priority:
5454

5555
misc:
5656
bukkit-yml-path: bukkit.yml
57+
server-properties-path: server.properties
5758
global-debug: 0
5859
debug-permissions: false
5960
silent-start: false

0 commit comments

Comments
 (0)