Accessing player NBT data

Discussion in 'Spigot Plugin Development' started by EmperorSuper, Jul 14, 2018 at 5:51 AM.

  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 at 5:51 AM
    Last edited: Jul 14, 2018 at 6:24 AM
  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();
         
            nmsEntity.c(tag);

            tag.setInt("XpLevel", 1234);

            EntityLiving el = (EntityLiving) nmsEntity;
            el.a(tag);
        }
    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?
     
  3. 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.
     
  4. 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)
     
  5. @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 (https://i.imgur.com/fIJVunR.png)
     

Share This Page