Skip to content

Commit

Permalink
Fixed LightSwitch
Browse files Browse the repository at this point in the history
  • Loading branch information
me4502 committed Feb 11, 2018
1 parent 0b60c0b commit 63c6dbe
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 63c6dbe

Please sign in to comment.