From ab593de219dc3abf09406ea8631ccb625a604762 Mon Sep 17 00:00:00 2001 From: zxq5 Date: Tue, 4 Feb 2025 12:51:23 +0000 Subject: [PATCH] refactored custom model setter & attributes --- .../zxq5/fantasysmp/items/GenericGearSet.java | 298 +++++++++--------- .../dev/zxq5/fantasysmp/items/Lightning.java | 19 +- .../zxq5/fantasysmp/items/StevensWrath.java | 23 +- .../dev/zxq5/fantasysmp/items/Witherite.java | 80 ++--- 4 files changed, 183 insertions(+), 237 deletions(-) diff --git a/src/main/java/dev/zxq5/fantasysmp/items/GenericGearSet.java b/src/main/java/dev/zxq5/fantasysmp/items/GenericGearSet.java index 69dfd38..144dcb7 100644 --- a/src/main/java/dev/zxq5/fantasysmp/items/GenericGearSet.java +++ b/src/main/java/dev/zxq5/fantasysmp/items/GenericGearSet.java @@ -5,6 +5,7 @@ import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.attribute.Attribute; import org.bukkit.attribute.AttributeModifier; +import org.bukkit.entity.Item; import org.bukkit.inventory.EquipmentSlotGroup; import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; @@ -16,169 +17,139 @@ import java.util.List; import java.util.UUID; public abstract class GenericGearSet implements HasRecipes { - protected int swordAttackDamage = 0; - protected float swordAttackSpeed = 0; - protected int swordDurability = 0; - protected String swordName = "wooden sword"; - protected String swordLore = ""; - protected int helmetArmour = 0; - protected int helmetArmourToughness = 0; - protected double helmetKnockbackResistance = 0; - protected int helmetDurability = 0; - protected String helmetName = "leather cap"; - protected String helmetLore = ""; - - protected int chestplateArmour = 0; - protected int chestplateArmourToughness = 0; - protected double chestplateKnockbackResistance = 0; - protected int chestplateDurability = 0; - protected String chestplateName = "leather tunic"; - protected String chestplateLore = ""; - - protected int leggingsArmour = 0; - protected int leggingsArmourToughness = 0; - protected double leggingsKnockbackResistance = 0; - protected int leggingsDurability = 0; - protected String leggingsName = "leather pants"; - protected String leggingsLore = ""; - - protected int bootsArmour = 0; - protected int bootsArmourToughness = 0; - protected double bootsKnockbackResistance = 0; - protected int bootsDurability = 0; - protected String bootsName = "leather boots"; - protected String bootsLore = ""; - - protected ItemStack helmetMaterial = new ItemStack(Material.LEATHER_HELMET); - protected ItemStack chestplateMaterial = new ItemStack(Material.LEATHER_CHESTPLATE); - protected ItemStack leggingsMaterial = new ItemStack(Material.LEATHER_LEGGINGS); - protected ItemStack bootsMaterial = new ItemStack(Material.LEATHER_BOOTS); - protected ItemStack swordMaterial = new ItemStack(Material.WOODEN_SWORD); + protected ItemStats sword = new ItemStats(); + protected ItemStats helmet = new ItemStats(); + protected ItemStats chestplate = new ItemStats(); + protected ItemStats leggings = new ItemStats(); + protected ItemStats boots = new ItemStats(); protected static RecipeChoice NETHERITE_UPGRADE = new RecipeChoice.MaterialChoice(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE); protected static RecipeChoice WITHER_SKULL = new RecipeChoice.MaterialChoice(Material.WITHER_SKELETON_SKULL); public void setTier1() { - swordAttackDamage = 4; - swordAttackSpeed = 1.6f; - - // todo: idk + sword.setMaterial(Material.WOODEN_SWORD); + helmet.setMaterial(Material.LEATHER_HELMET); + chestplate.setMaterial(Material.LEATHER_CHESTPLATE); + leggings.setMaterial(Material.LEATHER_LEGGINGS); + boots.setMaterial(Material.LEATHER_BOOTS); } public void setTier3() { - helmetMaterial = new ItemStack(Material.IRON_HELMET); - chestplateMaterial = new ItemStack(Material.IRON_CHESTPLATE); - leggingsMaterial = new ItemStack(Material.IRON_LEGGINGS); - ItemStack bootsMaterial = new ItemStack(Material.IRON_BOOTS); - swordMaterial = new ItemStack(Material.IRON_SWORD); + helmet.setMaterial(Material.IRON_HELMET); + chestplate.setMaterial(Material.IRON_CHESTPLATE); + leggings.setMaterial(Material.IRON_LEGGINGS); + boots.setMaterial(Material.IRON_BOOTS); + sword.setMaterial(Material.IRON_SWORD); - swordAttackDamage = 6; - swordAttackSpeed = 1.6f; - helmetArmour = 2; - helmetArmourToughness = 0; - chestplateArmour = 6; - chestplateArmourToughness = 0; - leggingsArmour = 5; - leggingsArmourToughness = 0; - bootsArmour = 2; - bootsArmourToughness = 0; + sword.attackDamage = 6; + sword.attackSpeed = 1.6f; + helmet.armour = 2; + helmet.armourToughness = 0; + chestplate.armour = 6; + chestplate.armourToughness = 0; + leggings.armour = 5; + leggings.armourToughness = 0; + boots.armour = 2; + boots.armourToughness = 0; } public void setTier4() { - helmetMaterial = new ItemStack(Material.DIAMOND_HELMET); - chestplateMaterial = new ItemStack(Material.DIAMOND_CHESTPLATE); - leggingsMaterial = new ItemStack(Material.DIAMOND_LEGGINGS); - bootsMaterial = new ItemStack(Material.DIAMOND_BOOTS); - swordMaterial = new ItemStack(Material.DIAMOND_SWORD); + helmet.setMaterial(Material.DIAMOND_HELMET); + chestplate.setMaterial(Material.DIAMOND_CHESTPLATE); + leggings.setMaterial(Material.DIAMOND_LEGGINGS); + boots.setMaterial(Material.DIAMOND_BOOTS); + sword.setMaterial(Material.DIAMOND_SWORD); - swordAttackDamage = 7; - swordAttackSpeed = 1.6f; - helmetArmour = 3; - helmetArmourToughness = 2; - chestplateArmour = 8; - chestplateArmourToughness = 2; - leggingsArmour = 6; - leggingsArmourToughness = 2; - bootsArmour = 3; - bootsArmourToughness = 2; + sword.attackDamage = 7; + sword.attackSpeed = 1.6f; + helmet.armour = 3; + helmet.armourToughness = 2; + chestplate.armour = 8; + chestplate.armourToughness = 2; + leggings.armour = 6; + leggings.armourToughness = 2; + boots.armour = 3; + boots.armourToughness = 2; } public void setTier5() { - helmetMaterial = new ItemStack(Material.NETHERITE_HELMET); - chestplateMaterial = new ItemStack(Material.NETHERITE_CHESTPLATE); - leggingsMaterial = new ItemStack(Material.NETHERITE_LEGGINGS); - bootsMaterial = new ItemStack(Material.NETHERITE_BOOTS); - swordMaterial = new ItemStack(Material.NETHERITE_SWORD); + helmet.setMaterial(Material.NETHERITE_HELMET); + chestplate.setMaterial(Material.NETHERITE_CHESTPLATE); + leggings.setMaterial(Material.NETHERITE_LEGGINGS); + boots.setMaterial(Material.NETHERITE_BOOTS); + sword.setMaterial(Material.NETHERITE_SWORD); - swordAttackDamage = 8; - swordAttackSpeed = 1.6f; - helmetArmour = 3; - helmetArmourToughness = 3; - helmetKnockbackResistance = 0.1; - chestplateArmour = 8; - chestplateArmourToughness = 3; - chestplateKnockbackResistance = 0.1; - leggingsArmour = 6; - leggingsArmourToughness = 3; - leggingsKnockbackResistance = 0.1; - bootsArmour = 3; - bootsArmourToughness = 3; - bootsKnockbackResistance = 0.1; + sword.attackDamage = 8; + sword.attackSpeed = 1.6f; + helmet.armour = 3; + helmet.armourToughness = 3; + helmet.knockbackResistance = 0.1; + chestplate.armour = 8; + chestplate.armourToughness = 3; + chestplate.knockbackResistance = 0.1; + leggings.armour = 6; + leggings.armourToughness = 3; + leggings.knockbackResistance = 0.1; + boots.armour = 3; + boots.armourToughness = 3; + boots.knockbackResistance = 0.1; } public void setTier6() { - helmetMaterial = new ItemStack(Material.NETHERITE_HELMET); - chestplateMaterial = new ItemStack(Material.NETHERITE_CHESTPLATE); - leggingsMaterial = new ItemStack(Material.NETHERITE_LEGGINGS); - bootsMaterial = new ItemStack(Material.NETHERITE_BOOTS); - swordMaterial = new ItemStack(Material.NETHERITE_SWORD); + helmet.setMaterial(Material.NETHERITE_HELMET); + chestplate.setMaterial(Material.NETHERITE_CHESTPLATE); + leggings.setMaterial(Material.NETHERITE_LEGGINGS); + boots.setMaterial(Material.NETHERITE_BOOTS); + sword.setMaterial(Material.NETHERITE_SWORD); - swordAttackDamage = 10; - swordAttackSpeed = 1.6f; - helmetArmour = 3; - helmetArmourToughness = 5; - helmetKnockbackResistance = 0.1; - chestplateArmour = 8; - chestplateArmourToughness = 5; - chestplateKnockbackResistance = 0.1; - leggingsArmour = 6; - leggingsArmourToughness = 5; - leggingsKnockbackResistance = 0.1; - bootsArmour = 3; - bootsArmourToughness = 5; - bootsKnockbackResistance = 0.1; + sword.attackDamage = 10; + sword.attackSpeed = 1.6f; + helmet.armour = 3; + helmet.armourToughness = 5; + helmet.knockbackResistance = 0.1; + chestplate.armour = 8; + chestplate.armourToughness = 5; + chestplate.knockbackResistance = 0.1; + leggings.armour = 6; + leggings.armourToughness = 5; + leggings.knockbackResistance = 0.1; + boots.armour = 3; + boots.armourToughness = 5; + boots.knockbackResistance = 0.1; } // this must be overridden by the child class. public static void init() {} public ItemStack getSword() { - ItemStack item = swordMaterial; + ItemStack item = sword.material; ItemMeta meta = item.getItemMeta(); meta.addAttributeModifier(Attribute.ATTACK_DAMAGE, new AttributeModifier( NamespacedKey.minecraft("generic.attack_damage"), - swordAttackDamage, + sword.attackDamage, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.HAND )); meta.addAttributeModifier(Attribute.ATTACK_SPEED, new AttributeModifier( NamespacedKey.minecraft("generic.attack_speed"), - swordAttackSpeed - 4, + sword.attackSpeed - 4, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.HAND )); meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - meta.setDisplayName(this.swordName); + meta.setDisplayName(sword.name); - ArrayList lore = new ArrayList<>(List.of(this.swordLore)); + if (!sword.customModel.isEmpty()) meta.setItemModel(NamespacedKey.fromString("fantasysmp:" + sword.customModel)); + + ArrayList lore = new ArrayList<>(List.of(sword.lore)); lore.add("\n"); lore.add(ChatColor.GRAY + "When in Main Hand:" + ChatColor.RESET); - if (swordAttackDamage > 0) lore.add(ChatColor.GREEN + " " + swordAttackDamage + " Attack Damage" + ChatColor.RESET); - if (swordAttackSpeed > 0) lore.add(ChatColor.GREEN + " " + swordAttackSpeed + " Attack Speed" + ChatColor.RESET); + if (sword.attackDamage > 0) lore.add(ChatColor.GREEN + " " + sword.attackDamage + " Attack Damage" + ChatColor.RESET); + if (sword.attackSpeed > 0) lore.add(ChatColor.GREEN + " " + sword.attackSpeed + " Attack Speed" + ChatColor.RESET); meta.setLore(lore); item.setItemMeta(meta); @@ -186,16 +157,16 @@ public abstract class GenericGearSet implements HasRecipes { } public ItemStack getHelmet() { - ItemStack item = helmetMaterial; + ItemStack item = helmet.material; ItemMeta meta = item.getItemMeta(); - meta.setDisplayName(this.helmetName); - meta.setLore(new ArrayList<>(List.of(this.helmetLore))); + meta.setDisplayName(helmet.name); + meta.setLore(new ArrayList<>(List.of(helmet.lore))); meta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier( UUID.randomUUID(), "armour", - (double) helmetArmour, + (double) helmet.armour, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.HEAD )); @@ -203,36 +174,37 @@ public abstract class GenericGearSet implements HasRecipes { meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier( UUID.randomUUID(), "armour_toughness", - helmetArmourToughness, + helmet.armourToughness, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.HEAD )); - if (helmetKnockbackResistance != 0) { + if (helmet.knockbackResistance != 0) { meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier( UUID.randomUUID(), "knockback_resistance", - helmetKnockbackResistance, + helmet.knockbackResistance, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.HEAD )); } + if (!helmet.customModel.isEmpty()) meta.setItemModel(NamespacedKey.fromString("fantasysmp:" + helmet.customModel)); item.setItemMeta(meta); return item; } public ItemStack getChestplate() { - ItemStack item = chestplateMaterial; + ItemStack item = chestplate.material; ItemMeta meta = item.getItemMeta(); - meta.setDisplayName(this.chestplateName); - meta.setLore(new ArrayList<>(List.of(this.chestplateLore))); + meta.setDisplayName(chestplate.name); + meta.setLore(new ArrayList<>(List.of(chestplate.lore))); meta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier( UUID.randomUUID(), "armour", - (double) chestplateArmour, + (double) chestplate.armour, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.CHEST )); @@ -240,36 +212,38 @@ public abstract class GenericGearSet implements HasRecipes { meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier( UUID.randomUUID(), "armour_toughness", - chestplateArmourToughness, + chestplate.armourToughness, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.CHEST )); - if (chestplateKnockbackResistance != 0) { + if (chestplate.knockbackResistance != 0) { meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier( UUID.randomUUID(), "knockback_resistance", - chestplateKnockbackResistance, + chestplate.knockbackResistance, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.CHEST )); } + if (!chestplate.customModel.isEmpty()) meta.setItemModel(NamespacedKey.fromString("fantasysmp:" + chestplate.customModel)); + item.setItemMeta(meta); return item; } public ItemStack getLeggings() { - ItemStack item = leggingsMaterial; + ItemStack item = leggings.material; ItemMeta meta = item.getItemMeta(); - meta.setDisplayName(this.leggingsName); - meta.setLore(new ArrayList<>(List.of(this.leggingsLore))); + meta.setDisplayName(leggings.name); + meta.setLore(new ArrayList<>(List.of(leggings.lore))); meta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier( UUID.randomUUID(), "armour", - (double) leggingsArmour, + (double) leggings.armour, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.LEGS )); @@ -277,36 +251,37 @@ public abstract class GenericGearSet implements HasRecipes { meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier( UUID.randomUUID(), "armour_toughness", - leggingsArmourToughness, + leggings.armourToughness, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.LEGS )); - if (leggingsKnockbackResistance != 0) { + if (leggings.knockbackResistance != 0) { meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier( UUID.randomUUID(), "knockback_resistance", - leggingsKnockbackResistance, + leggings.knockbackResistance, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.LEGS )); } + if (!leggings.customModel.isEmpty()) meta.setItemModel(NamespacedKey.fromString("fantasysmp:" + leggings.customModel)); item.setItemMeta(meta); return item; } public ItemStack getBoots() { - ItemStack item = bootsMaterial; + ItemStack item = boots.material; ItemMeta meta = item.getItemMeta(); - meta.setDisplayName(this.bootsName); - meta.setLore(new ArrayList<>(List.of(this.bootsLore))); + meta.setDisplayName(boots.name); + meta.setLore(new ArrayList<>(List.of(boots.lore))); meta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier( UUID.randomUUID(), "armour", - (double) bootsArmour, + (double) boots.armour, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.FEET )); @@ -314,26 +289,57 @@ public abstract class GenericGearSet implements HasRecipes { meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier( UUID.randomUUID(), "armour_toughness", - bootsArmourToughness, + boots.armourToughness, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.FEET )); - if (bootsKnockbackResistance != 0) { + if (boots.knockbackResistance != 0) { meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier( UUID.randomUUID(), "knockback_resistance", - bootsKnockbackResistance, + boots.knockbackResistance, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.FEET )); } + if (!boots.customModel.isEmpty()) meta.setItemModel(NamespacedKey.fromString("fantasysmp:" + boots.customModel)); item.setItemMeta(meta); return item; } } +class ItemStats { + public double attackDamage; + public double attackSpeed; + public int durability; + public int armour; + public int armourToughness; + public double knockbackResistance ; + public String name; + public String lore; + public String customModel; + public ItemStack material; + + public ItemStats() { + this.attackDamage = 0; + this.attackSpeed = 0; + this.durability = 0; + this.armour = 0; + this.armourToughness = 0; + this.knockbackResistance = 0; + this.name = ""; + this.lore = ""; + this.customModel = ""; + this.material = new ItemStack(Material.AIR); + } + + public void setMaterial(Material material) { + this.material = new ItemStack(material); + } +} + @@ -346,5 +352,3 @@ public abstract class GenericGearSet implements HasRecipes { - - diff --git a/src/main/java/dev/zxq5/fantasysmp/items/Lightning.java b/src/main/java/dev/zxq5/fantasysmp/items/Lightning.java index a1c5d3f..d797980 100644 --- a/src/main/java/dev/zxq5/fantasysmp/items/Lightning.java +++ b/src/main/java/dev/zxq5/fantasysmp/items/Lightning.java @@ -54,7 +54,7 @@ public class Lightning extends GenericGearSet implements Listener, CommandExecut return; } - if (!( LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.swordLore) )) return; + if (!( LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.sword.lore) )) return; if ( player.isOnGround() @@ -86,27 +86,18 @@ public class Lightning extends GenericGearSet implements Listener, CommandExecut .equals("minecraft:lightning_bolt") )) return; - if (LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.swordLore)) { + if (LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.sword.lore)) { event.setCancelled(true); } } } - @Override - public ItemStack getSword() { - ItemStack item = super.getSword(); - ItemMeta meta = item.getItemMeta(); - meta.setItemModel(NamespacedKey.fromString("fantasysmp:lightning_sword")); - item.setItemMeta(meta); - return item; - } - - public static void init() {} public Lightning() { this.setTier5(); - this.swordName = "Lightning Sword"; - this.swordLore = "All who oppose shall be smitten."; + this.sword.name = "Lightning Sword"; + this.sword.customModel = "lightning_sword"; + this.sword.lore = "All who oppose shall be smitten."; } } diff --git a/src/main/java/dev/zxq5/fantasysmp/items/StevensWrath.java b/src/main/java/dev/zxq5/fantasysmp/items/StevensWrath.java index 649aefd..b044eed 100644 --- a/src/main/java/dev/zxq5/fantasysmp/items/StevensWrath.java +++ b/src/main/java/dev/zxq5/fantasysmp/items/StevensWrath.java @@ -53,8 +53,8 @@ public class StevensWrath extends GenericGearSet implements Listener, CommandExe } if (!( - LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.swordLore) - || LoreChecker.itemLoreContains(player.getInventory().getItemInOffHand(), this.swordLore) + LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.sword.lore) + || LoreChecker.itemLoreContains(player.getInventory().getItemInOffHand(), this.sword.lore) )) return; Location location = event.getEntity().getLocation(); @@ -77,28 +77,19 @@ public class StevensWrath extends GenericGearSet implements Listener, CommandExe .equals("minecraft:lightning_bolt") )) return; - if (LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.swordLore) || - LoreChecker.itemLoreContains(player.getInventory().getItemInOffHand(), this.swordLore)) { + if (LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.sword.lore) || + LoreChecker.itemLoreContains(player.getInventory().getItemInOffHand(), this.sword.lore)) { event.setCancelled(true); } } } - @Override - public ItemStack getSword() { - ItemStack item = super.getSword(); - ItemMeta meta = item.getItemMeta(); - meta.setItemModel(NamespacedKey.fromString("fantasysmp:stevens_wrath")); - item.setItemMeta(meta); - return item; - } - - public static void init() {} public StevensWrath() { this.setTier6(); - this.swordName = ChatColor.LIGHT_PURPLE + "Stevens Wrath" + ChatColor.RESET; - this.swordLore = ChatColor.LIGHT_PURPLE + "All who oppose the mighty Steven shall face his wrath of lightning."; + this.sword.name = ChatColor.LIGHT_PURPLE + "Stevens Wrath" + ChatColor.RESET; + this.sword.customModel = "stevens_wrath"; + this.sword.lore = ChatColor.LIGHT_PURPLE + "All who oppose the mighty Steven shall face his wrath of lightning."; } } diff --git a/src/main/java/dev/zxq5/fantasysmp/items/Witherite.java b/src/main/java/dev/zxq5/fantasysmp/items/Witherite.java index ed7e3b6..2aa5d67 100644 --- a/src/main/java/dev/zxq5/fantasysmp/items/Witherite.java +++ b/src/main/java/dev/zxq5/fantasysmp/items/Witherite.java @@ -78,7 +78,7 @@ public class Witherite extends GenericGearSet implements Listener, CommandExecut return; } - if (!LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.swordLore)) { + if (!LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.sword.lore)) { return; } @@ -101,10 +101,10 @@ public class Witherite extends GenericGearSet implements Listener, CommandExecut } try { - if (LoreChecker.itemLoreContains(player.getInventory().getHelmet(), this.helmetLore) - && LoreChecker.itemLoreContains(player.getInventory().getChestplate(), this.chestplateLore) - && LoreChecker.itemLoreContains(player.getInventory().getLeggings(), this.leggingsLore) - && LoreChecker.itemLoreContains(player.getInventory().getBoots(), this.bootsLore) + if (LoreChecker.itemLoreContains(player.getInventory().getHelmet(), this.helmet.lore) + && LoreChecker.itemLoreContains(player.getInventory().getChestplate(), this.chestplate.lore) + && LoreChecker.itemLoreContains(player.getInventory().getLeggings(), this.leggings.lore) + && LoreChecker.itemLoreContains(player.getInventory().getBoots(), this.boots.lore) ) { event.setCancelled(true); } @@ -114,65 +114,25 @@ public class Witherite extends GenericGearSet implements Listener, CommandExecut } } - @Override - public ItemStack getSword() { - ItemStack item = super.getSword(); - ItemMeta meta = item.getItemMeta(); - meta.setItemModel(NamespacedKey.fromString("fantasysmp:witherite_sword")); - item.setItemMeta(meta); - return item; - } - - @Override - public ItemStack getHelmet() { - ItemStack item = super.getHelmet(); - ItemMeta meta = item.getItemMeta(); - meta.setItemModel(NamespacedKey.fromString("fantasysmp:witherite_helmet")); - item.setItemMeta(meta); - return item; - } - - @Override - public ItemStack getChestplate() { - ItemStack item = super.getChestplate(); - ItemMeta meta = item.getItemMeta(); - meta.setItemModel(NamespacedKey.fromString("fantasysmp:witherite_chestplate")); - item.setItemMeta(meta); - return item; - } - - @Override - public ItemStack getLeggings() { - ItemStack item = super.getLeggings(); - ItemMeta meta = item.getItemMeta(); - meta.setItemModel(NamespacedKey.fromString("fantasysmp:witherite_leggings")); - item.setItemMeta(meta); - return item; - } - - @Override - public ItemStack getBoots() { - ItemStack item = super.getBoots(); - ItemMeta meta = item.getItemMeta(); - meta.setItemModel(NamespacedKey.fromString("fantasysmp:witherite_boots")); - item.setItemMeta(meta); - return item; - } - public static void init() {} public Witherite() { this.setTier5(); - this.swordName = "Witherite Sword"; - this.helmetName = "Witherite Helmet"; - this.chestplateName = "Witherite Chestplate"; - this.leggingsName = "Witherite Leggings"; - this.bootsName = "Witherite Boots"; + this.sword.name = "Witherite Sword"; + this.sword.customModel = "witherite_sword"; + this.helmet.name = "Witherite Helmet"; + this.helmet.customModel = "witherite_helmet"; + this.chestplate.name = "Witherite Chestplate"; + this.chestplate.customModel = "witherite_chestplate"; + this.leggings.name = "Witherite Leggings"; + this.leggings.customModel = "witherite_leggings"; + this.boots.name = "Witherite Boots"; + this.boots.customModel = "witherite_boots"; - this.swordLore = "A sword forged with the skulls of wither skeletons."; - this.helmetLore = "A helmet forged with the skulls of wither skeletons."; - this.chestplateLore = "A chestplate forged with the skulls of wither skeletons."; - this.leggingsLore = "A leggings forged with the skulls of wither skeletons."; - this.bootsLore = "A boots forged with the skulls of wither skeletons."; + this.sword.lore = "A sword forged with the skulls of wither skeletons."; + this.helmet.lore = "A helmet forged with the skulls of wither skeletons."; + this.chestplate.lore = "A chestplate forged with the skulls of wither skeletons."; + this.leggings.lore = "Leggings forged with the skulls of wither skeletons."; + this.boots.lore = "Boots forged with the skulls of wither skeletons."; } }