Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. @EventHandler
  2. public void onPlayerJoin(PlayerJoinEvent e)
  3. {
  4. Player p = e.getPlayer();
  5. File playerFile = new File (getDataFolder(), p.getUniqueId().toString() + ".yml");
  6. FileConfiguration playerConfig = YamlConfiguration.loadConfiguration(playerFile);
  7.  
  8. if(!playerFile.exists()) {
  9. try {
  10. playerFile.createNewFile();
  11.  
  12. playerConfig.createSection("Spiller");
  13. String path = "Spiller.navn";
  14. playerConfig.addDefault(path, p.getDisplayName().toString());
  15.  
  16. String path2 = "Spiller.navn.bande";
  17. playerConfig.addDefault(path2, "null");
  18.  
  19.  
  20. } catch (IOException e1) {
  21. e1.printStackTrace();
  22. }
  23. }
  24. saveConfig();
  25. return;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement