Permalink
Browse files

Fixed LightSwitch

  • Loading branch information...
me4502 committed Feb 11, 2018
1 parent 0b60c0b commit 63c6dbe6a7947c72d158f0fd9c7f91e35542be87
@@ -30,6 +30,7 @@
import com.sk89q.craftbook.sponge.util.SpongePermissionNode;
import ninja.leaping.configurate.ConfigurationNode;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.block.BlockState;
import org.spongepowered.api.block.BlockTypes;
import org.spongepowered.api.block.tileentity.Sign;
import org.spongepowered.api.data.key.Keys;
@@ -128,12 +129,14 @@ private static void toggleSwitches(Location<World> location, boolean state, int
if (player != null)
Sponge.getCauseStackManager().pushCause(player);
offset.setBlock((state ? BlockTypes.TORCH : BlockTypes.REDSTONE_TORCH).getDefaultState());
BlockState newState = (state ? BlockTypes.TORCH : BlockTypes.REDSTONE_TORCH).getDefaultState();
if (connectedDirection.isPresent()) {
newState = newState.with(Keys.DIRECTION, connectedDirection.get()).get();
}
offset.setBlock(newState);
if (player != null)
Sponge.getCauseStackManager().popCause();
connectedDirection.ifPresent((direction) -> offset.offer(Keys.DIRECTION, direction));
if (toggledLights > maxLights)
return;
}

0 comments on commit 63c6dbe

Please sign in to comment.