/give data tags API

Discussion in 'Plugin Development' started by CaptainUniverse, Feb 28, 2015.

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

    CaptainUniverse

    Hey guys! By any chance do you guys know if there is an API or function somewhere in NMS or bukkit code that you enter a string it it tries to parse the data tags in the /give command? If so what is it?
     
  2. Offline

    mine-care

    @CaptainUniverse you mean for example: i do /give ironingot and it understands it? Well you need to make your own table of words related to objects, or develop an algorythm (or regex) to match input string with material values. for example check if input string matches AMaterialValue.toString().replace("_","").toLowerCase();
    Regex is not my thing so i cant provide an example :(
     
  3. Offline

    CaptainUniverse

    No I mean the like nbt tags like {displayName:{lol}} those ones which are at the end of the command
    @mine-care
     
  4. Offline

    mine-care

    @CaptainUniverse oh, still no, not something im aware of atlest
    Sorry for not helping :3
     
  5. Offline

    CaptainUniverse

    Oh well I tried looking into the bukkit code and the nms code but most of it is abstract and its hard to see what does what. Anyone else know maybe how essentials does it or just bukkit?

    Anyone?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 13, 2016
  6. Offline

    Konato_K

  7. Offline

    CaptainUniverse

    Im not sure but even it is @Konato_K it still takes a long time to read it. Is there any API for this in NMS code anyone?
     
  8. Offline

    Konato_K

    @CaptainUniverse Bukkit calls this when the bukkit /give command is used
    Code:
    stack = Bukkit.getUnsafe().modifyItemStack(stack, Joiner.on(' ').join(Arrays.asList(args).subList(4, args.length)));
    
    So, basically modifyItemStack takes the item and the String is the data tags.
     
  9. Offline

    CaptainUniverse

    So will it call an exception if the parsing is wrong? If it does what exception?
     
  10. Offline

    Konato_K

Thread Status:
Not open for further replies.

Share This Page