Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.Nighterance.main;
- import java.io.File;
- import java.io.IOException;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.configuration.file.YamlConfiguration;
- public class ConfigManager {
- private BottleBets plugin = BottleBets.getPlugin(BottleBets.class);
- // Files & File Configs Here
- public FileConfiguration potionsconfig;
- public File potionsfile;
- // --------------------------
- public void setup() {
- if (!plugin.getDataFolder().exists()) {
- plugin.getDataFolder().mkdir();
- }
- potionsfile = new File(plugin.getDataFolder(), "potions.yml");
- if (!potionsfile.exists()) {
- try {
- potionsfile.createNewFile();
- Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "We did it! potions.yml file was generated. Woohoo!");
- } catch (IOException e) {
- Bukkit.getServer().getConsoleSender()
- .sendMessage(ChatColor.RED + "Whait, what? We could not generate potions.yml. Why?");
- }
- }
- potionsconfig = YamlConfiguration.loadConfiguration(potionsfile);
- }
- public FileConfiguration getPlayers() {
- return potionsconfig;
- }
- public void savePlayers() {
- try {
- potionsconfig.save(potionsfile);
- Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.AQUA + "We just saved potions.yml");
- } catch (IOException e) {
- Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.RED + "We could not save potions.yml");
- }
- }
- public void reloadPlayers() {
- potionsconfig = YamlConfiguration.loadConfiguration(potionsfile);
- Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.BLUE + "We reloaded potions.yml file");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement