Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. public void createFac(Player p){
  2. CustomFactions plugin = CustomFactions.getInstance();
  3.  
  4. String name = tempName.get(0);
  5.  
  6. String factionn = name;
  7. File userdata = new File(plugin.getDataFolder(), File.separator + "FactionData");
  8. File f = new File(userdata, File.separator + factionn + ".yml");
  9. FileConfiguration factionData = YamlConfiguration.loadConfiguration(f);
  10.  
  11. if (!f.exists()) {
  12. try {
  13. f.createNewFile();
  14. } catch (IOException e) {
  15. e.printStackTrace();
  16. }
  17.  
  18. try {
  19. try {
  20. try {
  21. factionData.load(f);
  22. factionData.set("name", name);
  23. factionData.set("power", 10);
  24. factionData.save(f);
  25. } catch (FileNotFoundException e) {
  26. e.printStackTrace();
  27. } catch (IOException e) {
  28. e.printStackTrace();
  29. }
  30. } catch (InvalidConfigurationException e) {
  31. e.printStackTrace();
  32. }
  33. }finally {
  34.  
  35. }
  36. }
  37. tempName.clear();
  38. p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "(!) " + ChatColor.YELLOW + "You have created a faction!");
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement