Guest User

Untitled

a guest
Oct 9th, 2018
39
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Join implements Listener
  2. {
  3.  
  4. private static Main plugin = Main.getPlugin(Main.class);
  5.  
  6. @EventHandler(priority = EventPriority.HIGHEST)
  7. public void onJoin(PlayerJoinEvent e) {
  8. if(!e.getPlayer().hasPlayedBefore()) {
  9. plugin.Methods.saveSurvivalInventory(e.getPlayer());
  10. plugin.Methods.saveCreativeInventory(e.getPlayer());
  11. return;
  12. }
  13. if(e.getPlayer().getGameMode() != GameMode.CREATIVE) {
  14. plugin.Methods.saveSurvivalInventory(e.getPlayer());
  15. File CreativeInventory = new File(plugin.getDataFolder() + File.separator + "Inventories" + File.separator + "Inventories_" + e.getPlayer().getUniqueId() + File.separator + "creative.yml");
  16. FileConfiguration data = YamlConfiguration.loadConfiguration(CreativeInventory);
  17. File SurvivalInventory = new File(plugin.getDataFolder() + File.separator + "Inventories" + File.separator + "Inventories_" + e.getPlayer().getUniqueId() + File.separator + "survival.yml");
  18. FileConfiguration data2 = YamlConfiguration.loadConfiguration(SurvivalInventory);
  19. try {
  20. data.save(CreativeInventory);
  21. data.save(SurvivalInventory);
  22. } catch (IOException e2) {
  23. e2.printStackTrace();
  24. }
  25. return;
  26. }
  27. if(e.getPlayer().getGameMode() == GameMode.CREATIVE) {
  28. plugin.Methods.saveCreativeInventory(e.getPlayer());
  29. File SurvivalInventory = new File(plugin.getDataFolder() + File.separator + "Inventories" + File.separator + "Inventories_" + e.getPlayer().getUniqueId() + File.separator + "survival.yml");
  30. FileConfiguration data = YamlConfiguration.loadConfiguration(SurvivalInventory);
  31. File CreativeInventory = new File(plugin.getDataFolder() + File.separator + "Inventories" + File.separator + "Inventories_" + e.getPlayer().getUniqueId() + File.separator + "creative.yml");
  32. FileConfiguration data2= YamlConfiguration.loadConfiguration(CreativeInventory);
  33. try {
  34. data.save(SurvivalInventory);
  35. data2.save(CreativeInventory);
  36. } catch (IOException e2) {
  37. e2.printStackTrace();
  38. }
  39. return;
  40. }
  41. }
  42.  
  43. }
RAW Paste Data