-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: load supplementary config/ftbranks-pack.snbt file
Intended to augment existing ranks from ranks.snbt with pack-specific settings, to be created by modpack makers, and independent from the server admin settings.
- Loading branch information
Showing
4 changed files
with
75 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
common/src/main/java/dev/ftb/mods/ftbranks/impl/RankFileSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package dev.ftb.mods.ftbranks.impl; | ||
|
||
import dev.architectury.platform.Platform; | ||
import net.minecraft.server.MinecraftServer; | ||
|
||
import java.nio.file.Path; | ||
import java.util.function.Function; | ||
|
||
public enum RankFileSource { | ||
SERVER(server -> server.getWorldPath(RankManagerImpl.FOLDER_NAME).resolve("ranks.snbt")), | ||
MODPACK(server -> Platform.getConfigFolder().resolve("ftbranks-pack.snbt")); | ||
|
||
private final Function<MinecraftServer, Path> pathFunction; | ||
|
||
RankFileSource(Function<MinecraftServer, Path> pathFunction) { | ||
this.pathFunction = pathFunction; | ||
} | ||
|
||
public Path getPath(MinecraftServer server) { | ||
return pathFunction.apply(server); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters