Solved Are the names in the Material class the same ones used in /give?

Discussion in 'Spigot Plugin Development' started by ME1312, May 29, 2017.

  1. I would like to know If the names in the Material class are the same ones used by vanilla's /give (ignoring the minecraft: prefix of course)

    If not, how can I get a material using such names. (like minecraft:stone for example)
     
  2. Nope, the names are different and there is currently no API yet in bukkit to get the string ids for the materials.
    Currently you would have to map those ids yourself, or hook into minecraft code directly (nms). There exist various threads about this already. Here is the link to an old thread about this: https://www.spigotmc.org/threads/minecraft-id-string-to-material.60047/
     
  3. How strange, I suppose I'll be sticking to numeric ids for configs then. (It's what most are used to anyway)
     
  4. Or you use the material names as they are defined by bukkit. They don't match minecraft's string ids in some cases, but might still be better suited for configurations. You could even support both, numeric ids and material names with your config.
     
  5. I'd suggest using Vault's item API. It supports a wide range of different names (e.g: "sprucelog", "spruce_log")
     
  6. There's an idea: Perhaps I'll check for numeric, bukkit material, and vault names (if it's there of course). That way I probably won't miss anything, since the comments on the source code seems to indicate vault follows /give's capabilities
     
  7. mathhulk

    mathhulk Retired Moderator
    Retired

    Moved to Spigot Plugin Development.