From d8963cc189cc8cffdbc5b98c0225b8f9965cf964 Mon Sep 17 00:00:00 2001 From: Yaruma3341 Date: Sat, 6 Jul 2019 21:58:45 +0200 Subject: [PATCH] code cleanup Signed-off-by: Yaruma3341 --- src/me/yaruma/fightsystem/kit/Kit.java | 9 +-------- src/me/yaruma/fightsystem/kit/KitManager.java | 6 ++---- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/me/yaruma/fightsystem/kit/Kit.java b/src/me/yaruma/fightsystem/kit/Kit.java index e230379..edb84cd 100644 --- a/src/me/yaruma/fightsystem/kit/Kit.java +++ b/src/me/yaruma/fightsystem/kit/Kit.java @@ -10,15 +10,13 @@ public class Kit { private boolean leaderAllowed; private boolean memberAllowed; private ItemStack[] inventory; - private ItemStack[] armor; - public Kit(String name, int price, boolean leaderAllowed, boolean memberAllowed, ItemStack[] armor, ItemStack[] inventory) { + public Kit(String name, int price, boolean leaderAllowed, boolean memberAllowed, ItemStack[] inventory) { this.name = name; this.price = price; this.leaderAllowed = leaderAllowed; this.memberAllowed = memberAllowed; this.inventory = inventory; - this.armor = armor; } public String getName() { @@ -41,12 +39,7 @@ public class Kit { return inventory; } - public ItemStack[] getArmor() { - return armor; - } - public void loadToPlayer(Player player) { player.getInventory().setContents(inventory); - player.getInventory().setArmorContents(armor); } } diff --git a/src/me/yaruma/fightsystem/kit/KitManager.java b/src/me/yaruma/fightsystem/kit/KitManager.java index 9629a71..2f812eb 100644 --- a/src/me/yaruma/fightsystem/kit/KitManager.java +++ b/src/me/yaruma/fightsystem/kit/KitManager.java @@ -20,7 +20,7 @@ public class KitManager { private static final ArrayList loadedKits = new ArrayList<>(); public static void saveInventory(String kitName, Player player){ - loadedKits.add(new Kit(kitName, 0, true, true, player.getInventory().getArmorContents(), player.getInventory().getContents())); + loadedKits.add(new Kit(kitName, 0, true, true, player.getInventory().getContents())); saveAllKits(); } @@ -43,14 +43,13 @@ public class KitManager { FileConfiguration data = instance.getKitData(); String path = "Kits." + name; if(data.contains(path)) { - List armor = (List) data.getList(path + ".Armor"); List items = (List) data.getList(path + ".Items"); int price = data.getInt(path + ".Price"); boolean leaderAllowed = data.getBoolean(path + ".LeaderAllowed"); boolean memberAllowed = data.getBoolean(path + ".MemberAllowed"); - Kit kit = new Kit(name, price, leaderAllowed, memberAllowed, armor.toArray(new ItemStack[1]), items.toArray(new ItemStack[1])); + Kit kit = new Kit(name, price, leaderAllowed, memberAllowed, items.toArray(new ItemStack[1])); return kit; } return null; @@ -68,7 +67,6 @@ public class KitManager { YamlConfiguration yamlConfiguration = new YamlConfiguration(); for(Kit k : loadedKits){ String path = "Kits." + k.getName(); - yamlConfiguration.set(path + ".Armor", k.getArmor()); yamlConfiguration.set(path + ".Items", k.getInventory()); yamlConfiguration.set(path + ".Price", k.getPrice()); yamlConfiguration.set(path + ".LeaderAllowed", k.isLeaderAllowed());