NBT?

Discussion in 'Plugin Development' started by patey, Jun 7, 2014.

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

    patey

    I'm working on a plugin that is to work alongside a mod, and the person working on the mod wants to use NBT to store data such as the users race. while researching NBT and bukkit I discovered bukkit removed support for NBT, although I can't seem to find exactly why.

    there is an api I could use, but while skimming some stuff in a google search I read about it having something to do with security, are there any risks to using NBT with bukkit?
     
  2. Offline

    Mrawesomecookie

    patey
    Bukkit will automatically wrap around NBT. If you really wanted to you could use NMS. However, you could just use ItemMeta/etc.. and store it like that.
     
  3. Offline

    patey

    sorry I don't know a lot about the internals of minecraft and bukkit, what do you mean by wrap around it?

    I should probably mention that the plugin would need to be able to get and change the race value stored in NBT
     
  4. Offline

    oscarshi1995

    Plugin messaging channels perhaps?
     
  5. Offline

    xize

    yea you have 2 type ItemStacks one is from the bukkit and the other from the minecraft package it self.

    What I think you could convert it by using:

    Code:
    ItemStack stack = new ItemStack(Material.WOOD, 1);
    net.minecraft.server.<version>.ItemStack item = ((CraftItemStack)stack).getHandle(); //makes it into the minecraft internals
    
    //to convert back there is a method which is called smiliar as asBukkitStack() but I forgot the method name
    
    however I'm not good with nms and nbt tags I only think a beginning looks a bit like this.
     
  6. Offline

    patey

    Nope, working on a plugin for a modded server


    I should have specified it's a player entity I'm trying to retrieve the race tag from(is it called a tag? I don't even know that much about it -.-).I don't see anything about a handle in the javadocs for "Player", is it even possible with an entity?
     
  7. Offline

    oscarshi1995

    patey so? if its bukkit u can use messaging channels... if its not bukkit why are u asking on the bukkit forums?
     
  8. Offline

    patey

    sorry thought messaging channels was to do with chat, it is bukkit just using a modded bukkit server

    (when trying to edit the text in the edit popup disappears and I can't edit it :/ accidentally hit the post button)

    The mod will be storing the user's chosen class as an NBT tag, and the plugin will need to retrieve it to know what race they are when deciding if they are allowed to use certain recipes and blocks and stuff.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Nov 2, 2016
  9. Offline

    Aqua

    patey
    I suggest saving that kind of info to a storage file or database.
     
  10. Offline

    patey

    I plan to once I retrieve it from the mod, I couldn't really find any info n the messging channel, got a link?

    what I'm trying to do is store a user defined variable for the player entity (the race, also possibly the gender ),which in the mod determines the user's skin, in a way that I can retrieve it in the plugin when needed.
    What's the best way to do that?

    sorry agian, can't edit my post. meant to quote you oscarshi1995 before asking for a link about messaging channel

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Nov 2, 2016
  11. Offline

    Aqua

    patey
    Oh sorry, I misread your first post. I'm fairly new to client modding, but I read something about server-Forge being able to allow client connections without the mod itself. Use the server-Forge and message channeling from them.
    Correct me if I'm wrong please.
     
  12. Offline

    xTigerRebornx

    patey Since you are using a modded server software (I'm guessing MCPC+/Cauldron) to run mods, you'll have to ask how they handle the NBT there. There is a huge rule on the forums that builds not made by Bukkit aren't supported here (as its not very easy to support something they didn't make)
     
  13. Offline

    patey

    your guess is as good as mine then lol, I'm fairly new to client modding as well. still not very experienced with plugin development yet either though.
     
  14. Offline

    Garris0n

    Ask on the forums where you got the server software, they'll know better.
     
  15. Offline

    Europia79

  16. Offline

    TnT

    Locked. When developing plugins or mods for modded servers that are not CraftBukkit, look for help on the forums where you found your modded server. It is not possible to support software other than CraftBukkit/Bukkit.
     
Thread Status:
Not open for further replies.

Share This Page