Guest User

Untitled

a guest
Apr 21st, 2019
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. package de.leluckyyde.test.utils;
  2.  
  3. import org.bukkit.configuration.file.YamlConfiguration;
  4. import org.bukkit.entity.Player;
  5. import org.bukkit.inventory.ItemStack;
  6.  
  7. import java.io.File;
  8. import java.io.IOException;
  9. import java.util.HashMap;
  10.  
  11. public class Inventory {
  12.  
  13. public static void saveInventoryByLeave(Player player, File file) throws IOException {
  14. if (file.exists()) {
  15. YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  16. cfg.set("Items", player.getInventory().getContents());
  17. cfg.set("Armor", player.getInventory().getArmorContents());
  18. cfg.save(file);
  19. player.getInventory().clear();
  20. player.getInventory().setArmorContents(null);
  21. }
  22. }
  23.  
  24. public static void getInventoryByJoin(Player player, File file) {
  25. if (file.exists()) {
  26. YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment