Solved Is there any way to get the exact Material out of block.getType()

Discussion in 'Spigot Plugin Development' started by KurtSchluss, Oct 10, 2019.

Thread Status:
Not open for further replies.
  1. Hi,

    is there any way to get the exact name out of a Block.
    For example:
    I break a Birch Log: block.getType().name() returns LOG but i want to get BIRCH_LOG which is the normal name for a Birch log in the Material Name Enum.
    Same with any other Log types or any other item which has a :id like 17:2 for Birch Log

    Thanks for your help
     
  2. Try: block.getMaterial()

    If it worked let me know with a rating on my comment
     
  3. It gets me a little bit closer but with:
    block.getType().getMaterial(block.getType().name()) it returns LEGACY_LOG or do i need to give something different to the constructor ?
     
  4. I think you need to set the API version in your plugin.yml. What is your minecraft version?
     
  5. Im on 1.14 right now i dont really know what you mean with set the API cause im pretty new to Plugin Programming
     
  6. In your plugin.yml
    put api-version: 1.13 or 1.14
     
    • Agree Agree x 1
  7. it doesn't matter, then i'll just explain it to you.

    What you need to do is put this code in your plugin.yml:
    Code (YAML):
    api-version: 1.14
    Edit: changed capital letters
     
    #7 goedgamer123, Oct 10, 2019
    Last edited: Oct 10, 2019
    • Agree Agree x 1
  8. No.
    https://www.spigotmc.org/wiki/plugin-yml/
    It's case sensitive.

    You need to have, i.e
    Code (YAML):
    api-version: 1.14
     
    • Agree Agree x 1
  9. Thats working just perfect thank you guys so much for the fast help really appreciate it
     
Thread Status:
Not open for further replies.