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.
#Armor set bonuses
1 messages · Page 1 of 1 (latest)
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
@weary flint remaking hypixel skyblock?
probably xD
in a way. I am just trying to create a dungeon crawler almost. bunch of systems and a skill tree coming.
im doing the same but with extremly low knowledge of java and spigotapi
@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.
Ok, so can you send me a link to the lib ur using for the armour events?
if you want to do this, dont give the stats with a bunch of if/elses . instead create a map that tells how much stats should be added for each item and call the map.get() method everytime you wanted to add stats to the player but be carefull, if the item isnt available in the list you will get null so also handle that
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.
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
}
}
what happens when player swaps their armor ? the new armor won't be null. It will be whatever they swapped with.
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.
what spigot verison u using?
latest
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?
@fading abyss I dont understand what you mean. I do think it has to deal with how I am getting the armor contents tho.