Klasse ConfigFile
java.lang.Object
de.voxelmap.voxelconfig.ConfigFile
Simple configuration file supporting VoxelMap-style
Key:Value format.
Example usage:
ConfigFile config = new ConfigFile(gameDir.resolve("config/mymod.properties"));
// Loading
config.load(reader -> {
showHud = reader.getBoolean("Show HUD", true);
opacity = reader.getInt("Opacity", 100, 0, 255);
});
// Saving
config.save(writer -> {
writer.put("Show HUD", showHud);
writer.put("Opacity", opacity);
});
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifikator und TypKlasseBeschreibungstatic final classReader for accessing parsed config values with type-safe defaults.static final classWriter for outputting config key-value pairs. -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifikator und TypMethodeBeschreibungvoidload(Consumer<ConfigFile.Reader> consumer) Loads the config file and passes aConfigFile.Readerto the consumer.voidsave(Consumer<ConfigFile.Writer> consumer) Saves the config file, creating parent directories if needed.
-
Konstruktordetails
-
ConfigFile
-
-
Methodendetails
-
load
Loads the config file and passes aConfigFile.Readerto the consumer. If the file does not exist, the consumer receives an empty reader. -
save
Saves the config file, creating parent directories if needed.
-