CustomCode

Untitled

Jan 14th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. String playerName = p.getName();
  2. File userdata = new File(Bukkit.getServer().getPluginManager().getPlugin("Hub").getDataFolder(), File.separator + "PlayerDatabase");
  3. File f = new File(userdata, File.separator + playerName + ".yml");
  4. FileConfiguration playerData = YamlConfiguration.loadConfiguration(f);
  5.  
  6. //When the player file is created for the first time...
  7. if (!f.exists()) {
  8. try {
  9.  
  10. playerData.createSection("currency");
  11. playerData.set("currency.balance", 100);
  12.  
  13. playerData.createSection("stats");
  14. playerData.set("stats.totalLogins", 1);
  15.  
  16. playerData.save(f);
  17. } catch (IOException exception) {
  18.  
  19. exception.printStackTrace();
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment