Changing the "Attack Damage" Value on a weapon

Discussion in 'Plugin Development' started by Supergrupgr, Apr 21, 2020.

Thread Status:
Not open for further replies.
  1. Offline

    Supergrupgr

    Alright so, I am currently remaking hypixels skyblock, for fun, but I wanted to change what it says for Attack Damage, at the bottom of the item, not just change what it says but liek the actual DAMAGE, of the weapon too, I have researched & found nothing, can anyone help?
     
  2. Offline

    RBT_KitK4t

    Add to the item meta you want to change the attack damage the attribute modifier GENERIC_ATTACK_DAMAGE in the Attribute class.

    It should look like this:
    meta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, new AttributeModifier("generic.attackDamage", amountPts, Operation.ADD_NUMBER));

    Make sure you replace the "amountPts" by the amount of points of attack damage you want to add.



    Sent from my SM-T580 using Tapatalk
     
  3. Offline

    Supergrupgr

    Add, or set to, just to clarify

    I tried it & it didnt work, there wasnt proper imports for Attribute.

    nor for Operation, nothing is going right, there isnt proper imports that match with this stuff.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Apr 21, 2020
  4. Offline

    RBT_KitK4t

    Well it depends of your current version of Bukkit/Spigot. If I am not wrong, the Attributes API have been added in the version 1.9 of the Bukkit API. Prior to that version, using NMS is mandatory. You can find more information about it on forums (I know there are some threads on that topic). This requires the use of NBT tags which is not that complicated (even for reflection). For instance, Hypixels may use NMS because they support v1.8 (this is a supposition).
     
Thread Status:
Not open for further replies.

Share This Page