#Armor set bonuses

1 messages · Page 1 of 1 (latest)

weary flint
#

I am trying to create armor set bonuses for certain types of armor I have in the game. I am using jeffs ArmorEquipEvent to check for when a player equips armor. I dont exactly know how to keep track of everything and when to give the player the bonus from the set, and when to take it away. the set i am currently working on is for mana. I have a mana system that stores the maxMana a player has in their PDC alongside the manaPerSec the current mana is stored in a hashmap. When the player has a full set of the Lapis Armor, they should be given +200 maxMana. when the player takes it off, their max mana should be reduced by 200. Thats how I would like my system to work, I'm just not sure how to implement it and keep track of everything to know when a player should be given the bonus, and if they already have the bonus, so it doesn't stack.

fading abyss
#

Ok

#

on the equip event

#

you check if the player is wearing a full set

#

if so, you add +200 Mana to the PDC

#

on the unequip event, you remove 200 Mana from the PDC

magic meadow
#

@weary flint remaking hypixel skyblock?

fading abyss
#

probably xD

weary flint
magic meadow
weary flint
#

@fading abyss I get what you are saying, but I just dont know how to implement that yk? its simple checking if the player has my armor equiped. What I cant figure out is when to give the player the bonus, or how to. every attempt i've made before, players could duplicate the process and keep adding +200 mana without it being removed. the ArmorEquipEvent confuses me as the Armor unequip and equip are put together and i dont like that.

fading abyss
#

Ok, so can you send me a link to the lib ur using for the armour events?

weary flint
magic meadow
weary flint
#

That's my plan for the future, but as of right now, I am just trying to proove this concept that I can get this working. Than I'll optimize later on.

#

1 step at a time.

fading abyss
#

Ok, i created a request to him to add an unequip event but for now, you can use

#

public void urEvent(IdkTheEventName event){
  if(event.getNewArmorPiece() == null) {
  //remove mana here  
  }
}
weary flint
#

what happens when player swaps their armor ? the new armor won't be null. It will be whatever they swapped with.

fading abyss
#

second

#

check if the new armourpiece, has the namespacedkey of Lapis

weary flint
#

whena. player removes armor would that be the oldArmor?

#

yes it would

#

?paste

thorny fractalBOT
weary flint
#

So this is what I have now https://paste.md-5.net/tafokutixa.cs @fading abyss

Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.getItemMeta()" because "armorContents[39]" is null
    at pine.toast.rpg.GameEvents.Armors.LapisArmorSet.onLapisArmorEquip(LapisArmorSet.java:30) ~[?:?]

I get this for all armor contents. I dont know if this is the correct way to be doing this either. I feel there is a more simplistic or justa. better format to use then what im doing.

fading abyss
#

what spigot verison u using?

weary flint
#

latest

fading abyss
#

Get a player inventory

#

then you can get the item in there slots

weary flint
#

wouldn't that be the exact same thing to what I already have?

        ItemMeta helmet = armorContents[39].getItemMeta();
        ItemMeta chestplate = armorContents[38].getItemMeta();
        ItemMeta leggings = armorContents[37].getItemMeta();
        ItemMeta boots = armorContents[36].getItemMeta();

This should give back the armor contents maybe I have the number/id wrong?

weary flint
#

@fading abyss I dont understand what you mean. I do think it has to deal with how I am getting the armor contents tho.