Provided data is not of type org.bukkit.material.MaterialData, found org.bukkit.material.Bed

Discussion in 'Plugin Development' started by Blockhead7360, Jul 16, 2016.

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

    Blockhead7360

    Hello!

    I am trying to set a bed block, but I don't know what I'm doing wrong:

    Code:
    Block bedFoot = player.getWorld().getBlockAt(loc.getBlockX(), 1, loc.getBlockZ());
            Block bedHead = player.getWorld().getBlockAt(loc.getBlockX() + 1, 1, loc.getBlockZ());
            bedHead.setType(Material.BED_BLOCK);
            bedFoot.setType(Material.BED_BLOCK);
            Bed bed = new Bed();
            bed.setHeadOfBed(true);
            bedHead.getState().setData(bed);
            bedHead.getState().update();
    It says that the bed is not of type MaterialData, but doesn't the Bed class extend MaterialData?

    Thanks!
     
  2. Offline

    mine-care

    That is because this method expects metadata as parameter and you provide it with something that is not MetaData in the inheritance hierarchy. This means that you will have to get the data of the bed somehow :/
     
Thread Status:
Not open for further replies.

Share This Page