Get block from config and replace it

Discussion in 'Bukkit Discussion' started by ima_wizzard, Jan 10, 2019.

  1. Offline

    ima_wizzard

    ?
    Hello,
    Im storing a block in my config.yml
    upload_2019-1-10_17-57-40.png
    upload_2019-1-10_17-58-3.png

    how can i place that block with a command.
    player.getLocation().getBlock().set.....

    Thx for the replies.
     
  2. Offline

    KarimAKL

    @ima_wizzard Does something like this work for you?
    Code:Java
    1. Block block = locc.getBlock(); //locc is the location you want to set the block at
    2. Material type = Material.matchMaterial(getConfig().getString("b.type"));
    3. byte data = Byte.parseByte(getConfig().getString("b.data"));
    4. Biome biome = Biome.valueOf(getConfig().getString("b.biome"));
    5. block.setType(type);
    6. block.setData(data);
    7. block.setBiome(biome);
     
  3. Offline

    ima_wizzard

    block.setData() is wrong, do i need to use block.setblockData() ?

    @KarimAKL
    and I can't get the Materials:
    upload_2019-1-10_19-26-31.png
    if I print the type, it is null
     
    Last edited by a moderator: Jan 10, 2019

Share This Page