Solved Editing Player Stats

Discussion in 'Plugin Development' started by PhantomUnicorns, Jan 22, 2017.

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

    PhantomUnicorns

    I'm trying to edit basic player attributes, like attack_speed, hunger bar (total, don't know if this is possible), health bar total. I've gotten to the point of
    Code:
                HumanEntity p = (HumanEntity) player;
                MetadataValue mdv = p.getMetadata("");
    
    but I'm unsure what types of MetaDataValues are their. This also returns a list, not a singular value, I understand this but it really doesn't matter because I don't know how to get anything :p. If any knows or can direct me to a list of them that would be great, also if I'm doing this completely wrong please tell me (I'll research the right way and if I don't come to a conclusion I'll let you know)
     
  2. Offline

    AlvinB

    @PhantomUnicorns
    Well, the method getMetadata has nothing to do with the attributes you're talking about. Metadata is a way for plugins to store information on players. To modify an attribute, simply do this:
    Code:java
    1. player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(1024)
    Here's a list of all possible attributes:
    http://minecraft.gamepedia.com/Attribute
     
  3. Offline

    PhantomUnicorns

    Thanks, I already found the answer from some friends anyways (Was just going to mark this as solved) XD
     
Thread Status:
Not open for further replies.

Share This Page