Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void createFac(Player p){
- CustomFactions plugin = CustomFactions.getInstance();
- String name = tempName.get(0);
- String factionn = name;
- File userdata = new File(plugin.getDataFolder(), File.separator + "FactionData");
- File f = new File(userdata, File.separator + factionn + ".yml");
- FileConfiguration factionData = YamlConfiguration.loadConfiguration(f);
- if (!f.exists()) {
- try {
- f.createNewFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
- try {
- try {
- try {
- factionData.load(f);
- factionData.set("name", name);
- factionData.set("power", 10);
- factionData.save(f);
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- } catch (InvalidConfigurationException e) {
- e.printStackTrace();
- }
- }finally {
- }
- }
- tempName.clear();
- p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "(!) " + ChatColor.YELLOW + "You have created a faction!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement