Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.iamguus.tenrin.storage;
- import java.io.File;
- import java.io.IOException;
- import java.util.UUID;
- import me.iamguus.tenrin.Main;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.configuration.file.YamlConfiguration;
- import org.bukkit.entity.Player;
- public class PerPlayerConfig {
- UUID uuid;
- private FileConfiguration f;
- private File d;
- public PerPlayerConfig(Player p) {
- this.uuid = p.getUniqueId();
- this.d = new File(Main.getPlugin().getDataFolder(), "users" + File.separator + this.uuid + ".yml");
- this.f = YamlConfiguration.loadConfiguration((File)this.d);
- }
- public PerPlayerConfig(UUID uuid) {
- this.uuid = uuid;
- this.d = new File(Main.getPlugin().getDataFolder(), "users" + File.separator + this.uuid + ".yml");
- this.f = YamlConfiguration.loadConfiguration((File)this.d);
- }
- public void createFile() {
- File d = new File(Main.getPlugin().getDataFolder(), "users");
- File f = new File(Main.getPlugin().getDataFolder(), "users" + File.separator + this.uuid + ".yml");
- if (!d.exists()) {
- d.mkdirs();
- }
- if (!f.exists()) {
- try {
- f.createNewFile();
- }
- catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- public FileConfiguration getFile() {
- return f;
- }
- public void saveFile() {
- try {
- this.f.save(this.d);
- } catch (IOException ex) {
- ex.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement