Advertisement
Dark_FX

kit_save

Jul 11th, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. private void kit_save(Player player, String inventory) {
  2. if (!sectionExists(player.getUniqueId() + "." + inventory)){
  3. this.getConfig().createSection(player.getUniqueId() + "." + inventory);
  4. }else{
  5.  
  6. ItemStack[] contents = player.getInventory().getContents();
  7. for (int i = 0; i < contents.length; i++) {
  8. if (contents[i] != null && contents[i].getType() != Material.AIR) {
  9. this.getConfig().set(player.getUniqueId() + "." + inventory + "." + i, contents[i]);
  10. }
  11. }
  12. this.getConfig().set(player.getUniqueId() + "." + inventory + ".armour.helmet", player.getInventory().getHelmet());
  13. this.getConfig().set(player.getUniqueId() + "." + inventory + ".armour.chestplate", player.getInventory().getChestplate());
  14. this.getConfig().set(player.getUniqueId() + "." + inventory + ".armour.leggings", player.getInventory().getLeggings());
  15. this.getConfig().set(player.getUniqueId() + "." + inventory + ".armour.boots", player.getInventory().getBoots());
  16.  
  17. player.sendMessage(ChatColor.RED + "KIT: " + ChatColor.GRAY + "Saving kit " + ChatColor.AQUA + inventory);
  18. this.saveConfig();
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement