Solved Accessing player NBT data

Discussion in 'Spigot Plugin Development' started by EmperorSuper, Jul 14, 2018.

  1. Can someone explain to me how to access nbt data of players?
    I have no idea how to work with nbt so I'd really appreciate it if you helped me :D
    #1 EmperorSuper, Jul 14, 2018
    Last edited: Jul 14, 2018
    • Like Like x 1
    • Like Like x 1
    • Like Like x 1
  2. Ok so I've got it using

    Code (Java):
        public static void test(Entity e) {
            net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity) e).getHandle();

            NBTTagCompound tag = new NBTTagCompound();

            tag.setInt("XpLevel", 1234);

            EntityLiving el = (EntityLiving) nmsEntity;
    but what if I want to get something from these folder thingies, like the abilities one? I've using abilities.walkSpeed for example but it doesn't work, Any ideas?
    • Like Like x 1
  3. A N Y O N E ? ? ? ?
    • Like Like x 1
  4. you can change the walking speed without NBT, however here’s how you do it with NBT. I found on the internet you need to change generic.movementSpeed, so try that.
  5. Not 100% sure what are you trying to do. Are you trying to edit online player NBT data (Not sure for whatever reason since Player interface is pretty comprehensive) or changing the offline player NBT data from .dat files? (Plus for 1.7.10 not sure how is done)
  6. @Parozzz I'm trying to edit an online player's nbt data, I've successfully changed one integers but I don't know how to change the ones that are inside of categories like the abilities one for example (
    • Like Like x 1
  7. Hi, EmperorSuper. I know your last post to this thread was almost two months ago, but I was wondering if you found anything that worked. I'm trying to do the same thing with an OfflinePlayer's inventory. I've managed to get the data, but I don't know how to use the NBT methods to change specific parts like the inventory. Have you found a way to do this yet?
  8. I am using the PowerNBT api to do it.
  9. JanTuck


    It’s super easy, look st player file and you will se alot of available tags.