Chris
Chris

Reputation: 53

Creating Multiple YAML configurations in Java

Plugin for Minecraft(bukkit)

Hello, how do I create multiple configuration files? I'm trying to make it so users can create a config file in their datafolder for a custom TNT that they can create in-game using /actnt create "Name" Using this command they will create a new config file for their custom TNT I'm thinking of making a function/method like "generateConfig("Config name" and file to copy from src into their dataFolder)

Example to create a file called fireTNT (Copying from SRC/TNTdefault.yml to dataFolder: generateConfig(fireTNT, TNTdefault.yml);

Sorry, i'm bad at explaining, but is this possible? And how?

Upvotes: 0

Views: 293

Answers (1)

Ben Siebert
Ben Siebert

Reputation: 44

You can use the YamlConfiguration Class.

This could look like:

FileConfiguration config = YamlConfiguration.load(new File("/path/to/file.yml"));
FileConfiguration config2 = YamlConfiguration.load(new File("/path/to/file2.yml"));

Upvotes: 1

Related Questions