|
1 | 1 | package net.licks92.wirelessredstone.signs; |
2 | 2 |
|
3 | | -import net.licks92.wirelessredstone.compat.InternalProvider; |
4 | 3 | import net.licks92.wirelessredstone.Utils; |
5 | 4 | import net.licks92.wirelessredstone.WirelessRedstone; |
| 5 | +import net.licks92.wirelessredstone.compat.InternalProvider; |
6 | 6 | import net.licks92.wirelessredstone.materiallib.data.CrossMaterial; |
7 | 7 | import org.bukkit.Location; |
8 | 8 | import org.bukkit.Material; |
|
12 | 12 | import org.bukkit.configuration.serialization.ConfigurationSerializable; |
13 | 13 | import org.bukkit.configuration.serialization.SerializableAs; |
14 | 14 |
|
| 15 | +import java.util.Arrays; |
15 | 16 | import java.util.HashMap; |
16 | 17 | import java.util.Map; |
17 | 18 |
|
@@ -65,7 +66,6 @@ protected void changeState(boolean newState, String channelName) { |
65 | 66 | } |
66 | 67 |
|
67 | 68 | getLocation().getWorld().loadChunk(getLocation().getChunk()); |
68 | | - |
69 | 69 | Block block = getLocation().getBlock(); |
70 | 70 |
|
71 | 71 | if (isWallSign()) { |
@@ -102,11 +102,16 @@ protected void changeState(boolean newState, String channelName) { |
102 | 102 | } |
103 | 103 | } else { |
104 | 104 | if (newState) { |
105 | | - |
106 | 105 | CrossMaterial.REDSTONE_TORCH.setMaterial(block); |
107 | 106 | } else { |
108 | 107 | CrossMaterial.SIGN.setMaterial(block); |
109 | 108 |
|
| 109 | + if (Arrays.asList(BlockFace.UP, BlockFace.DOWN).contains(direction)) { |
| 110 | + WirelessRedstone.getWRLogger().warning("Receiver " + toString() + " has an invalid BlockFace! " + |
| 111 | + "The BlockFace values=[up, down] are invalid, using default BlockFace"); |
| 112 | + return; |
| 113 | + } |
| 114 | + |
110 | 115 | if (!(block.getState() instanceof Sign)) { |
111 | 116 | WirelessRedstone.getWRLogger().warning("Receiver " + toString() + " is not a Sign but the plugin does expect it to be a Sign. " + |
112 | 117 | "Is the sign at a valid location?"); |
|
0 commit comments