refactored custom model setter & attributes
Java CI with Maven / build (push) Failing after 1m5s

This commit is contained in:
2025-02-04 12:51:23 +00:00
parent 3633ad2d51
commit ab593de219
4 changed files with 183 additions and 237 deletions
@@ -5,6 +5,7 @@ import org.bukkit.Material;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.attribute.Attribute; import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier; import org.bukkit.attribute.AttributeModifier;
import org.bukkit.entity.Item;
import org.bukkit.inventory.EquipmentSlotGroup; import org.bukkit.inventory.EquipmentSlotGroup;
import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@@ -16,169 +17,139 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
public abstract class GenericGearSet implements HasRecipes { 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 ItemStats sword = new ItemStats();
protected int helmetArmourToughness = 0; protected ItemStats helmet = new ItemStats();
protected double helmetKnockbackResistance = 0; protected ItemStats chestplate = new ItemStats();
protected int helmetDurability = 0; protected ItemStats leggings = new ItemStats();
protected String helmetName = "leather cap"; protected ItemStats boots = new ItemStats();
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 static RecipeChoice NETHERITE_UPGRADE = new RecipeChoice.MaterialChoice(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE); 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); protected static RecipeChoice WITHER_SKULL = new RecipeChoice.MaterialChoice(Material.WITHER_SKELETON_SKULL);
public void setTier1() { public void setTier1() {
swordAttackDamage = 4; sword.setMaterial(Material.WOODEN_SWORD);
swordAttackSpeed = 1.6f; helmet.setMaterial(Material.LEATHER_HELMET);
chestplate.setMaterial(Material.LEATHER_CHESTPLATE);
// todo: idk leggings.setMaterial(Material.LEATHER_LEGGINGS);
boots.setMaterial(Material.LEATHER_BOOTS);
} }
public void setTier3() { public void setTier3() {
helmetMaterial = new ItemStack(Material.IRON_HELMET); helmet.setMaterial(Material.IRON_HELMET);
chestplateMaterial = new ItemStack(Material.IRON_CHESTPLATE); chestplate.setMaterial(Material.IRON_CHESTPLATE);
leggingsMaterial = new ItemStack(Material.IRON_LEGGINGS); leggings.setMaterial(Material.IRON_LEGGINGS);
ItemStack bootsMaterial = new ItemStack(Material.IRON_BOOTS); boots.setMaterial(Material.IRON_BOOTS);
swordMaterial = new ItemStack(Material.IRON_SWORD); sword.setMaterial(Material.IRON_SWORD);
swordAttackDamage = 6; sword.attackDamage = 6;
swordAttackSpeed = 1.6f; sword.attackSpeed = 1.6f;
helmetArmour = 2; helmet.armour = 2;
helmetArmourToughness = 0; helmet.armourToughness = 0;
chestplateArmour = 6; chestplate.armour = 6;
chestplateArmourToughness = 0; chestplate.armourToughness = 0;
leggingsArmour = 5; leggings.armour = 5;
leggingsArmourToughness = 0; leggings.armourToughness = 0;
bootsArmour = 2; boots.armour = 2;
bootsArmourToughness = 0; boots.armourToughness = 0;
} }
public void setTier4() { public void setTier4() {
helmetMaterial = new ItemStack(Material.DIAMOND_HELMET); helmet.setMaterial(Material.DIAMOND_HELMET);
chestplateMaterial = new ItemStack(Material.DIAMOND_CHESTPLATE); chestplate.setMaterial(Material.DIAMOND_CHESTPLATE);
leggingsMaterial = new ItemStack(Material.DIAMOND_LEGGINGS); leggings.setMaterial(Material.DIAMOND_LEGGINGS);
bootsMaterial = new ItemStack(Material.DIAMOND_BOOTS); boots.setMaterial(Material.DIAMOND_BOOTS);
swordMaterial = new ItemStack(Material.DIAMOND_SWORD); sword.setMaterial(Material.DIAMOND_SWORD);
swordAttackDamage = 7; sword.attackDamage = 7;
swordAttackSpeed = 1.6f; sword.attackSpeed = 1.6f;
helmetArmour = 3; helmet.armour = 3;
helmetArmourToughness = 2; helmet.armourToughness = 2;
chestplateArmour = 8; chestplate.armour = 8;
chestplateArmourToughness = 2; chestplate.armourToughness = 2;
leggingsArmour = 6; leggings.armour = 6;
leggingsArmourToughness = 2; leggings.armourToughness = 2;
bootsArmour = 3; boots.armour = 3;
bootsArmourToughness = 2; boots.armourToughness = 2;
} }
public void setTier5() { public void setTier5() {
helmetMaterial = new ItemStack(Material.NETHERITE_HELMET); helmet.setMaterial(Material.NETHERITE_HELMET);
chestplateMaterial = new ItemStack(Material.NETHERITE_CHESTPLATE); chestplate.setMaterial(Material.NETHERITE_CHESTPLATE);
leggingsMaterial = new ItemStack(Material.NETHERITE_LEGGINGS); leggings.setMaterial(Material.NETHERITE_LEGGINGS);
bootsMaterial = new ItemStack(Material.NETHERITE_BOOTS); boots.setMaterial(Material.NETHERITE_BOOTS);
swordMaterial = new ItemStack(Material.NETHERITE_SWORD); sword.setMaterial(Material.NETHERITE_SWORD);
swordAttackDamage = 8; sword.attackDamage = 8;
swordAttackSpeed = 1.6f; sword.attackSpeed = 1.6f;
helmetArmour = 3; helmet.armour = 3;
helmetArmourToughness = 3; helmet.armourToughness = 3;
helmetKnockbackResistance = 0.1; helmet.knockbackResistance = 0.1;
chestplateArmour = 8; chestplate.armour = 8;
chestplateArmourToughness = 3; chestplate.armourToughness = 3;
chestplateKnockbackResistance = 0.1; chestplate.knockbackResistance = 0.1;
leggingsArmour = 6; leggings.armour = 6;
leggingsArmourToughness = 3; leggings.armourToughness = 3;
leggingsKnockbackResistance = 0.1; leggings.knockbackResistance = 0.1;
bootsArmour = 3; boots.armour = 3;
bootsArmourToughness = 3; boots.armourToughness = 3;
bootsKnockbackResistance = 0.1; boots.knockbackResistance = 0.1;
} }
public void setTier6() { public void setTier6() {
helmetMaterial = new ItemStack(Material.NETHERITE_HELMET); helmet.setMaterial(Material.NETHERITE_HELMET);
chestplateMaterial = new ItemStack(Material.NETHERITE_CHESTPLATE); chestplate.setMaterial(Material.NETHERITE_CHESTPLATE);
leggingsMaterial = new ItemStack(Material.NETHERITE_LEGGINGS); leggings.setMaterial(Material.NETHERITE_LEGGINGS);
bootsMaterial = new ItemStack(Material.NETHERITE_BOOTS); boots.setMaterial(Material.NETHERITE_BOOTS);
swordMaterial = new ItemStack(Material.NETHERITE_SWORD); sword.setMaterial(Material.NETHERITE_SWORD);
swordAttackDamage = 10; sword.attackDamage = 10;
swordAttackSpeed = 1.6f; sword.attackSpeed = 1.6f;
helmetArmour = 3; helmet.armour = 3;
helmetArmourToughness = 5; helmet.armourToughness = 5;
helmetKnockbackResistance = 0.1; helmet.knockbackResistance = 0.1;
chestplateArmour = 8; chestplate.armour = 8;
chestplateArmourToughness = 5; chestplate.armourToughness = 5;
chestplateKnockbackResistance = 0.1; chestplate.knockbackResistance = 0.1;
leggingsArmour = 6; leggings.armour = 6;
leggingsArmourToughness = 5; leggings.armourToughness = 5;
leggingsKnockbackResistance = 0.1; leggings.knockbackResistance = 0.1;
bootsArmour = 3; boots.armour = 3;
bootsArmourToughness = 5; boots.armourToughness = 5;
bootsKnockbackResistance = 0.1; boots.knockbackResistance = 0.1;
} }
// this must be overridden by the child class. // this must be overridden by the child class.
public static void init() {} public static void init() {}
public ItemStack getSword() { public ItemStack getSword() {
ItemStack item = swordMaterial; ItemStack item = sword.material;
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
meta.addAttributeModifier(Attribute.ATTACK_DAMAGE, new AttributeModifier( meta.addAttributeModifier(Attribute.ATTACK_DAMAGE, new AttributeModifier(
NamespacedKey.minecraft("generic.attack_damage"), NamespacedKey.minecraft("generic.attack_damage"),
swordAttackDamage, sword.attackDamage,
AttributeModifier.Operation.ADD_NUMBER, AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.HAND EquipmentSlotGroup.HAND
)); ));
meta.addAttributeModifier(Attribute.ATTACK_SPEED, new AttributeModifier( meta.addAttributeModifier(Attribute.ATTACK_SPEED, new AttributeModifier(
NamespacedKey.minecraft("generic.attack_speed"), NamespacedKey.minecraft("generic.attack_speed"),
swordAttackSpeed - 4, sword.attackSpeed - 4,
AttributeModifier.Operation.ADD_NUMBER, AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.HAND EquipmentSlotGroup.HAND
)); ));
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
meta.setDisplayName(this.swordName); meta.setDisplayName(sword.name);
ArrayList<String> lore = new ArrayList<>(List.of(this.swordLore)); if (!sword.customModel.isEmpty()) meta.setItemModel(NamespacedKey.fromString("fantasysmp:" + sword.customModel));
ArrayList<String> lore = new ArrayList<>(List.of(sword.lore));
lore.add("\n"); lore.add("\n");
lore.add(ChatColor.GRAY + "When in Main Hand:" + ChatColor.RESET); lore.add(ChatColor.GRAY + "When in Main Hand:" + ChatColor.RESET);
if (swordAttackDamage > 0) lore.add(ChatColor.GREEN + " " + swordAttackDamage + " Attack Damage" + ChatColor.RESET); if (sword.attackDamage > 0) lore.add(ChatColor.GREEN + " " + sword.attackDamage + " Attack Damage" + ChatColor.RESET);
if (swordAttackSpeed > 0) lore.add(ChatColor.GREEN + " " + swordAttackSpeed + " Attack Speed" + ChatColor.RESET); if (sword.attackSpeed > 0) lore.add(ChatColor.GREEN + " " + sword.attackSpeed + " Attack Speed" + ChatColor.RESET);
meta.setLore(lore); meta.setLore(lore);
item.setItemMeta(meta); item.setItemMeta(meta);
@@ -186,16 +157,16 @@ public abstract class GenericGearSet implements HasRecipes {
} }
public ItemStack getHelmet() { public ItemStack getHelmet() {
ItemStack item = helmetMaterial; ItemStack item = helmet.material;
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
meta.setDisplayName(this.helmetName); meta.setDisplayName(helmet.name);
meta.setLore(new ArrayList<>(List.of(this.helmetLore))); meta.setLore(new ArrayList<>(List.of(helmet.lore)));
meta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier( meta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier(
UUID.randomUUID(), UUID.randomUUID(),
"armour", "armour",
(double) helmetArmour, (double) helmet.armour,
AttributeModifier.Operation.ADD_NUMBER, AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.HEAD EquipmentSlotGroup.HEAD
)); ));
@@ -203,36 +174,37 @@ public abstract class GenericGearSet implements HasRecipes {
meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier( meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier(
UUID.randomUUID(), UUID.randomUUID(),
"armour_toughness", "armour_toughness",
helmetArmourToughness, helmet.armourToughness,
AttributeModifier.Operation.ADD_NUMBER, AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.HEAD EquipmentSlotGroup.HEAD
)); ));
if (helmetKnockbackResistance != 0) { if (helmet.knockbackResistance != 0) {
meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier( meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier(
UUID.randomUUID(), UUID.randomUUID(),
"knockback_resistance", "knockback_resistance",
helmetKnockbackResistance, helmet.knockbackResistance,
AttributeModifier.Operation.ADD_NUMBER, AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.HEAD EquipmentSlotGroup.HEAD
)); ));
} }
if (!helmet.customModel.isEmpty()) meta.setItemModel(NamespacedKey.fromString("fantasysmp:" + helmet.customModel));
item.setItemMeta(meta); item.setItemMeta(meta);
return item; return item;
} }
public ItemStack getChestplate() { public ItemStack getChestplate() {
ItemStack item = chestplateMaterial; ItemStack item = chestplate.material;
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
meta.setDisplayName(this.chestplateName); meta.setDisplayName(chestplate.name);
meta.setLore(new ArrayList<>(List.of(this.chestplateLore))); meta.setLore(new ArrayList<>(List.of(chestplate.lore)));
meta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier( meta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier(
UUID.randomUUID(), UUID.randomUUID(),
"armour", "armour",
(double) chestplateArmour, (double) chestplate.armour,
AttributeModifier.Operation.ADD_NUMBER, AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.CHEST EquipmentSlotGroup.CHEST
)); ));
@@ -240,36 +212,38 @@ public abstract class GenericGearSet implements HasRecipes {
meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier( meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier(
UUID.randomUUID(), UUID.randomUUID(),
"armour_toughness", "armour_toughness",
chestplateArmourToughness, chestplate.armourToughness,
AttributeModifier.Operation.ADD_NUMBER, AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.CHEST EquipmentSlotGroup.CHEST
)); ));
if (chestplateKnockbackResistance != 0) { if (chestplate.knockbackResistance != 0) {
meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier( meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier(
UUID.randomUUID(), UUID.randomUUID(),
"knockback_resistance", "knockback_resistance",
chestplateKnockbackResistance, chestplate.knockbackResistance,
AttributeModifier.Operation.ADD_NUMBER, AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.CHEST EquipmentSlotGroup.CHEST
)); ));
} }
if (!chestplate.customModel.isEmpty()) meta.setItemModel(NamespacedKey.fromString("fantasysmp:" + chestplate.customModel));
item.setItemMeta(meta); item.setItemMeta(meta);
return item; return item;
} }
public ItemStack getLeggings() { public ItemStack getLeggings() {
ItemStack item = leggingsMaterial; ItemStack item = leggings.material;
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
meta.setDisplayName(this.leggingsName); meta.setDisplayName(leggings.name);
meta.setLore(new ArrayList<>(List.of(this.leggingsLore))); meta.setLore(new ArrayList<>(List.of(leggings.lore)));
meta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier( meta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier(
UUID.randomUUID(), UUID.randomUUID(),
"armour", "armour",
(double) leggingsArmour, (double) leggings.armour,
AttributeModifier.Operation.ADD_NUMBER, AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.LEGS EquipmentSlotGroup.LEGS
)); ));
@@ -277,36 +251,37 @@ public abstract class GenericGearSet implements HasRecipes {
meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier( meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier(
UUID.randomUUID(), UUID.randomUUID(),
"armour_toughness", "armour_toughness",
leggingsArmourToughness, leggings.armourToughness,
AttributeModifier.Operation.ADD_NUMBER, AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.LEGS EquipmentSlotGroup.LEGS
)); ));
if (leggingsKnockbackResistance != 0) { if (leggings.knockbackResistance != 0) {
meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier( meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier(
UUID.randomUUID(), UUID.randomUUID(),
"knockback_resistance", "knockback_resistance",
leggingsKnockbackResistance, leggings.knockbackResistance,
AttributeModifier.Operation.ADD_NUMBER, AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.LEGS EquipmentSlotGroup.LEGS
)); ));
} }
if (!leggings.customModel.isEmpty()) meta.setItemModel(NamespacedKey.fromString("fantasysmp:" + leggings.customModel));
item.setItemMeta(meta); item.setItemMeta(meta);
return item; return item;
} }
public ItemStack getBoots() { public ItemStack getBoots() {
ItemStack item = bootsMaterial; ItemStack item = boots.material;
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
meta.setDisplayName(this.bootsName); meta.setDisplayName(boots.name);
meta.setLore(new ArrayList<>(List.of(this.bootsLore))); meta.setLore(new ArrayList<>(List.of(boots.lore)));
meta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier( meta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier(
UUID.randomUUID(), UUID.randomUUID(),
"armour", "armour",
(double) bootsArmour, (double) boots.armour,
AttributeModifier.Operation.ADD_NUMBER, AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.FEET EquipmentSlotGroup.FEET
)); ));
@@ -314,26 +289,57 @@ public abstract class GenericGearSet implements HasRecipes {
meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier( meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier(
UUID.randomUUID(), UUID.randomUUID(),
"armour_toughness", "armour_toughness",
bootsArmourToughness, boots.armourToughness,
AttributeModifier.Operation.ADD_NUMBER, AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.FEET EquipmentSlotGroup.FEET
)); ));
if (bootsKnockbackResistance != 0) { if (boots.knockbackResistance != 0) {
meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier( meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier(
UUID.randomUUID(), UUID.randomUUID(),
"knockback_resistance", "knockback_resistance",
bootsKnockbackResistance, boots.knockbackResistance,
AttributeModifier.Operation.ADD_NUMBER, AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.FEET EquipmentSlotGroup.FEET
)); ));
} }
if (!boots.customModel.isEmpty()) meta.setItemModel(NamespacedKey.fromString("fantasysmp:" + boots.customModel));
item.setItemMeta(meta); item.setItemMeta(meta);
return item; 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 {
@@ -54,7 +54,7 @@ public class Lightning extends GenericGearSet implements Listener, CommandExecut
return; return;
} }
if (!( LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.swordLore) )) return; if (!( LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.sword.lore) )) return;
if ( if (
player.isOnGround() player.isOnGround()
@@ -86,27 +86,18 @@ public class Lightning extends GenericGearSet implements Listener, CommandExecut
.equals("minecraft:lightning_bolt") .equals("minecraft:lightning_bolt")
)) return; )) return;
if (LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.swordLore)) { if (LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.sword.lore)) {
event.setCancelled(true); 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 static void init() {}
public Lightning() { public Lightning() {
this.setTier5(); this.setTier5();
this.swordName = "Lightning Sword"; this.sword.name = "Lightning Sword";
this.swordLore = "All who oppose shall be smitten."; this.sword.customModel = "lightning_sword";
this.sword.lore = "All who oppose shall be smitten.";
} }
} }
@@ -53,8 +53,8 @@ public class StevensWrath extends GenericGearSet implements Listener, CommandExe
} }
if (!( if (!(
LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.swordLore) LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.sword.lore)
|| LoreChecker.itemLoreContains(player.getInventory().getItemInOffHand(), this.swordLore) || LoreChecker.itemLoreContains(player.getInventory().getItemInOffHand(), this.sword.lore)
)) return; )) return;
Location location = event.getEntity().getLocation(); Location location = event.getEntity().getLocation();
@@ -77,28 +77,19 @@ public class StevensWrath extends GenericGearSet implements Listener, CommandExe
.equals("minecraft:lightning_bolt") .equals("minecraft:lightning_bolt")
)) return; )) return;
if (LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.swordLore) || if (LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.sword.lore) ||
LoreChecker.itemLoreContains(player.getInventory().getItemInOffHand(), this.swordLore)) { LoreChecker.itemLoreContains(player.getInventory().getItemInOffHand(), this.sword.lore)) {
event.setCancelled(true); 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 static void init() {}
public StevensWrath() { public StevensWrath() {
this.setTier6(); this.setTier6();
this.swordName = ChatColor.LIGHT_PURPLE + "Stevens Wrath" + ChatColor.RESET; this.sword.name = 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.customModel = "stevens_wrath";
this.sword.lore = ChatColor.LIGHT_PURPLE + "All who oppose the mighty Steven shall face his wrath of lightning.";
} }
} }
@@ -78,7 +78,7 @@ public class Witherite extends GenericGearSet implements Listener, CommandExecut
return; return;
} }
if (!LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.swordLore)) { if (!LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.sword.lore)) {
return; return;
} }
@@ -101,10 +101,10 @@ public class Witherite extends GenericGearSet implements Listener, CommandExecut
} }
try { try {
if (LoreChecker.itemLoreContains(player.getInventory().getHelmet(), this.helmetLore) if (LoreChecker.itemLoreContains(player.getInventory().getHelmet(), this.helmet.lore)
&& LoreChecker.itemLoreContains(player.getInventory().getChestplate(), this.chestplateLore) && LoreChecker.itemLoreContains(player.getInventory().getChestplate(), this.chestplate.lore)
&& LoreChecker.itemLoreContains(player.getInventory().getLeggings(), this.leggingsLore) && LoreChecker.itemLoreContains(player.getInventory().getLeggings(), this.leggings.lore)
&& LoreChecker.itemLoreContains(player.getInventory().getBoots(), this.bootsLore) && LoreChecker.itemLoreContains(player.getInventory().getBoots(), this.boots.lore)
) { ) {
event.setCancelled(true); 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 static void init() {}
public Witherite() { public Witherite() {
this.setTier5(); this.setTier5();
this.swordName = "Witherite Sword"; this.sword.name = "Witherite Sword";
this.helmetName = "Witherite Helmet"; this.sword.customModel = "witherite_sword";
this.chestplateName = "Witherite Chestplate"; this.helmet.name = "Witherite Helmet";
this.leggingsName = "Witherite Leggings"; this.helmet.customModel = "witherite_helmet";
this.bootsName = "Witherite Boots"; 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.sword.lore = "A sword forged with the skulls of wither skeletons.";
this.helmetLore = "A helmet forged with the skulls of wither skeletons."; this.helmet.lore = "A helmet forged with the skulls of wither skeletons.";
this.chestplateLore = "A chestplate forged with the skulls of wither skeletons."; this.chestplate.lore = "A chestplate forged with the skulls of wither skeletons.";
this.leggingsLore = "A leggings forged with the skulls of wither skeletons."; this.leggings.lore = "Leggings forged with the skulls of wither skeletons.";
this.bootsLore = "A boots forged with the skulls of wither skeletons."; this.boots.lore = "Boots forged with the skulls of wither skeletons.";
} }
} }