Generating a list of Materials in the config

Discussion in 'Plugin Development' started by diamondcodes, Nov 25, 2014.

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

    diamondcodes

    Hello,

    I am wondering how I would set a Material in a config with a value and how I would get that value. So for example when somebody types /Test it will add EMERALD_BLOCK: 0 to the config and when they type /TestMsg it will send the sender a msg saying (The value of EMERALD_BLOCK) + " is the value of emerald Block!"
     
  2. Offline

    Skionz

    diamondcodes format your config like this
    Code:
    Materials:
      EMERALD_BLOCK: 0
      DIAMOND_BLOCK: 3
    You can use FileConfiguration#getConfigurationSection(key)
     
  3. Offline

    diamondcodes

    Skionz So if I wanted to set the material on command I would use
    Code:
    getConfig().set("Test" + "." + Material.EMERALD_BLOCK, 0)
     
  4. Offline

    Skionz

  5. Offline

    diamondcodes

    Skionz One more question how would I create a list of all minecraft blocks? With our typing them all out
     
  6. Offline

    Rocoty

    Use the docs. Material#values and Material#isBlock will be all you need
     
Thread Status:
Not open for further replies.

Share This Page