Hello, i want to open by my plugin a door by location, my code is:
Optional<BlockState> stato = porte.getLocation().getBlock().copy().with(Keys.OPEN, !door.getLocation().getBlock().get(Keys.OPEN).get()); // i get state and copy it, and i apply the open mode inversed.
if(stato.isPresent()){ //verification
BlockState stat = stato.get(); //get the final state
porte.getLocation().setBlock(stat, Cause.source(Sponge.getPluginManager().fromInstance(this).get()).build()); // i apply it
}
but it doesn’t work. do you know why?
i don’t have any error, but it don’t move