Solved Convert String -> Material 1.13

Discussion in 'Spigot Plugin Development' started by MagenPurp, Jul 29, 2018.

  1. Hi Guys, i've tried several methods to convert from string to material
    but they aren't working, can someone tell me how can i convert String - > Material
  2. You mean Material.valueOf(<String>) ?
  3. Yeah but when i use it, says that Material.LEGACY_LIME_DYE doesn't exist, the thing is if i use .valueOf(String) adds the LEGACY_ in my config it's set to LIME_DYE
  4. try Material.getMaterial(use config and get string here.);
  5. Material.getMaterial("LIME_BANNER");
    returns null
  6. Choco


    Your plugin.yml should state "api-version: 1.13". Either way, you should be using Material#matchMaterial() instead.
  7. okay, i will test
  8. OOooh, Version 1.13? I didn't know that.
  9. if i will set this "api-version: 1.13" the plugin will work back on 1.12? with the old item names?
  10. md_5

    Administrator Developer

    There is no supported way to use 1.12 and 1.13 materials in the same plugin.
    This is clearly outlined in the release notes.
  11. i mean if the plugin it's loaded from 1.8 - 1.12 server it will create the Files with the old items
    if the plugin is loaded from 1.13 it will set the 1.13 Material Names.
    my question is, if i will use
    api-version: 1.13 in plugin.yml, the plugin can be loaded on 1.12 ?
  12. Fixed and works 1.8-1.13 :D
    if other users have this problem, add "api-version: 1.13" in plugin yml, it won't break the plugin compatibility with other versions
  13. md_5

    Administrator Developer

    It will if you directly access any Material that was renamed (read: a lot)
    • Agree Agree x 1