items.db

Discussion in 'Plugin Development' started by Nohup, Mar 14, 2011.

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

    Nohup

    Since this was pointed out as a deficit in my Minecraft knowledge, someone explain this one to me. From what I can see it is what it says it is and lists the items for the server. However, from the code I have read that uses it, you have to create and parse it yourself? The way I was being reamed over this I was thinking it must be some standard file for the game, but I can find no reference to it in the Bukkit source and can't find it on my local machine or server. So, who wants to enlighten me, and afterwards we can discuss its merits.
     
  2. Offline

    narrowtux

    Look in Material.java this Enum is contains both the ids as well as the text-representation.
     
  3. Offline

    Nohup

    I know, that is what I am using, but a certain poster on this board reamed me in my plugin thread for not using items.db like "every other plugin does". From what I can see it is an externally editable file, so to me it makes no sense to use it when the enums cover the values and are what the rest of the Bukkit sources use, so I am putting this out there to see what I am missing that is so good from items.db. The code I saw yesterday that did use it has actually pulled it OUT of their plugin...
     
  4. Offline

    kroimon

    AFAIK items.db is file initially introduced by Nijikokun for the Generals and Cleaner plugin to support user defined item names. Other plugins may have adapted this for their needs, so this is no official part of bukkit or the minecraft server itself.
    If you want to use it for your plugins, you have to parse it yourself the way you need it (some plugins need it for id->name translations, others for the name->id direction).
     
  5. Offline

    Nohup

    thanks Kroimon, it was Nijikokun's code I was looking at that pulled it out (dispenser) so now I feel better.
     
  6. Offline

    clash

    The reason my plugin uses items.db is that I can add shorthand aliases for commonly used items/blocks. Since no other plugin I use references it anymore, I moved items.db into my plugin folder directly, too.

    Anyway, other than aliases there's not much point in it anymore.

    Look at the source to the "give" command in ScrapBukkit. It contains a simple method for matching item/block names to their id using the Material enum. [​IMG]
     
  7. Offline

    Nohup

    Yah, I use the Material enum, but one of the people trying to configure my plugin went off on me for not using items.db. I chose to use the string value of the Materials because I feel it is easier to read than a string of numbers, and they were all upset that it didn't match items.db and went as far as telling me I didn't know what I was doing for not using it. Basically, I would much rather go with something that is part of the bukkit source than an external file that I have to parse separately and that can be manipulated a whole lot easier...
     
  8. Offline

    DiddiZ

    I also prefer to use the material enum. But you can easily sopport item id, the Material.matchMaterial() method also accepts a string of an id.
     
Thread Status:
Not open for further replies.

Share This Page