Solved Getting blocks from the config

Discussion in 'Spigot Plugin Development' started by MeDen, Feb 26, 2020.

  1. There is a code
    Code (Text):
       public void WitherEatBlock(final EntityChangeBlockEvent e) {
           Material Wither = e.getBlock().getType();
           final EntityType type = e.getEntity().getType();
           if (type == EntityType.WITHER && (Wither == Material.COAL_BLOCK || Wither == Material.DIAMOND_BLOCK)) {

    There is a config

    Code (Text):

    How to get blocks instead
    Code (Text):
    (Wither == Material.COAL_BLOCK || Wither == Material.DIAMOND_BLOCK)
  2. Store those in a list or an array: { Blocks: COAL_BLOCK,DIAMOND_BLOCK }
    You'll need to store them as Material though, using Material.valueOf(string)
    And then
    if (array.contains(Wither))
    // do something
  3. Thanks