I have trouble casting a block to a chest. I've done this before in another project, excatly like this and it works fine, but I can't solve this one atm. Location chestLocation = new Location(world, chestX, chestY, chestZ); chestLocation.getBlock().setType(Material.CHEST); Chest chest = (Chest) chestLocation.getBlock().getState(); Error message: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_18_R2.block.CraftBlockState cannot be cast to class org.bukkit.block.Chest (org.bukkit.craftbukkit.v1_18_R2.block.CraftBlockState and org.bukkit.block.Chest are in unnamed module of loader java.net.URLClassLoader @46ee7fe8) I've had this working in another plugin, and after updating BuildTools and recompiling the old plugin it stopped working.