Skip to content
Open
21 changes: 17 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,26 @@
<packaging>jar</packaging>

<name>Deadbolt</name>
<url>https://github.com/daemitus/Deadbolt</url>
<url>https://github.com/md-5/Deadbolt</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/public/</url>
</repository>
<repository>
<id>bukkit-repo</id>
<name>Bukkit Repo</name>
<url>http://repo.bukkit.org/content/groups/public</url>
</repository>
<repository>
<id>AnnotatedConfig</id>
<url>https://github.com/md-5/AnnotatedConfig</url>
</repository>
<repository>
<id>essentials-repo</id>
<url>http://ess.ementalo.com/nexus/content/groups/public/</url>
Expand All @@ -33,8 +46,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -64,7 +77,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.8-R0.1-SNAPSHOT</version>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>com.md_5</groupId>
Expand Down
15 changes: 12 additions & 3 deletions src/main/java/com/daemitus/deadbolt/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,24 @@ public class Config extends AnnotatedConfig {
@ConfigComment("List of blockIDs protected by redstone unless overrode by [everyone]")
public List<Integer> redstone_protected_blockids = Arrays.asList(
// Doors
Material.WOODEN_DOOR.getId(),
Material.IRON_DOOR_BLOCK.getId(),
Material.OAK_DOOR.getId(),
Material.IRON_DOOR.getId(),
Material.SPRUCE_DOOR.getId(),
Material.BIRCH_DOOR.getId(),
Material.JUNGLE_DOOR.getId(),
Material.ACACIA_DOOR.getId(),
Material.DARK_OAK_DOOR.getId(),
Material.WARPED_DOOR.getId(),
Material.CRIMSON_DOOR.getId(),
// trap doors
Material.TRAP_DOOR.getId(),
Material.OAK_TRAPDOOR.getId(),
Material.BIRCH_TRAPDOOR.getId(),
Material.SPRUCE_TRAPDOOR.getId(),
Material.JUNGLE_TRAPDOOR.getId(),
Material.ACACIA_TRAPDOOR.getId(),
Material.DARK_OAK_TRAPDOOR.getId(),
Material.WARPED_TRAPDOOR.getId(),
Material.CRIMSON_TRAPDOOR.getId(),
Material.IRON_TRAPDOOR.getId()
);
@ConfigComment("Denies function of the [timer: x] tag on signs")
Expand Down
38 changes: 30 additions & 8 deletions src/main/java/com/daemitus/deadbolt/DeadboltCommandExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,32 @@ private boolean fix(Player player) {

private void fixHelper(Player player, Block block) {
switch (block.getType()) {
case WOODEN_DOOR:
case IRON_DOOR_BLOCK:
case OAK_DOOR:
case IRON_DOOR:
case SPRUCE_DOOR:
case BIRCH_DOOR:
case JUNGLE_DOOR:
case ACACIA_DOOR:
case DARK_OAK_DOOR:
case TRAP_DOOR:
case WARPED_DOOR:
case CRIMSON_DOOR:
case OAK_TRAPDOOR:
case BIRCH_TRAPDOOR:
case SPRUCE_TRAPDOOR:
case JUNGLE_TRAPDOOR:
case ACACIA_TRAPDOOR:
case DARK_OAK_TRAPDOOR:
case WARPED_TRAPDOOR:
case CRIMSON_TRAPDOOR:
case IRON_TRAPDOOR:
case FENCE_GATE:
case OAK_FENCE_GATE:
case BIRCH_FENCE_GATE:
case ACACIA_FENCE_GATE:
case DARK_OAK_FENCE_GATE:
case JUNGLE_FENCE_GATE:
case SPRUCE_FENCE_GATE:
case WARPED_FENCE_GATE:
case CRIMSON_FENCE_GATE:
block.setData((byte) (block.getData() ^ 0x4));
break;
default:
Expand All @@ -184,21 +195,32 @@ private boolean fixAll(Player player) {

private void fixAllHelper(Player player, Block block, Deadbolted db) {
switch (block.getType()) {
case WOODEN_DOOR:
case IRON_DOOR_BLOCK:
case OAK_DOOR:
case IRON_DOOR:
case SPRUCE_DOOR:
case BIRCH_DOOR:
case JUNGLE_DOOR:
case ACACIA_DOOR:
case DARK_OAK_DOOR:
case TRAP_DOOR:
case WARPED_DOOR:
case CRIMSON_DOOR:
case OAK_TRAPDOOR:
case BIRCH_TRAPDOOR:
case SPRUCE_TRAPDOOR:
case JUNGLE_TRAPDOOR:
case ACACIA_TRAPDOOR:
case DARK_OAK_TRAPDOOR:
case WARPED_TRAPDOOR:
case CRIMSON_TRAPDOOR:
case IRON_TRAPDOOR:
case FENCE_GATE:
case OAK_FENCE_GATE:
case BIRCH_FENCE_GATE:
case ACACIA_FENCE_GATE:
case DARK_OAK_FENCE_GATE:
case JUNGLE_FENCE_GATE:
case SPRUCE_FENCE_GATE:
case WARPED_FENCE_GATE:
case CRIMSON_FENCE_GATE:
for (Block b : db.getBlocks()) {
if (b.getType().equals(block.getType())) {
b.setData((byte) (b.getData() ^ 0x4));
Expand Down
82 changes: 70 additions & 12 deletions src/main/java/com/daemitus/deadbolt/Deadbolted.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,50 @@ private void search(Block block) {
switch (block.getType()) {
case AIR:
break;
case WALL_SIGN:
case OAK_WALL_SIGN:
case SPRUCE_WALL_SIGN:
case BIRCH_WALL_SIGN:
case ACACIA_WALL_SIGN:
case JUNGLE_WALL_SIGN:
case DARK_OAK_WALL_SIGN:
case WARPED_WALL_SIGN:
case CRIMSON_WALL_SIGN:
BlockState state = block.getState();
org.bukkit.block.Sign signState = (Sign) state;
if (Deadbolt.getLanguage().isValidWallSign(signState)) {
search(Util.getSignAttached(signState));
}
break;
case WOODEN_DOOR:
case IRON_DOOR_BLOCK:
case OAK_DOOR:
case IRON_DOOR:
case SPRUCE_DOOR:
case BIRCH_DOOR:
case JUNGLE_DOOR:
case ACACIA_DOOR:
case DARK_OAK_DOOR:
case CRIMSON_DOOR:
case WARPED_DOOR:
searchDoor(block, true, true);
break;
case FENCE_GATE:
case OAK_FENCE_GATE:
case BIRCH_FENCE_GATE:
case ACACIA_FENCE_GATE:
case DARK_OAK_FENCE_GATE:
case JUNGLE_FENCE_GATE:
case SPRUCE_FENCE_GATE:
case WARPED_FENCE_GATE:
case CRIMSON_FENCE_GATE:
searchFenceGate(block, true, true);
break;
case TRAP_DOOR:
case OAK_TRAPDOOR:
case BIRCH_TRAPDOOR:
case SPRUCE_TRAPDOOR:
case ACACIA_TRAPDOOR:
case DARK_OAK_TRAPDOOR:
case JUNGLE_TRAPDOOR:
case SPRUCE_TRAPDOOR:
case WARPED_TRAPDOOR:
case CRIMSON_TRAPDOOR:
case IRON_TRAPDOOR:
searchTrapDoor(block, true, Deadbolt.getConfig().vertical_trapdoors);
break;
Expand All @@ -77,11 +96,31 @@ private void search(Block block) {
searchSimpleBlock(block, Deadbolt.getConfig().group_cauldrons, Deadbolt.getConfig().group_cauldrons);
break;
case FURNACE:
case BLAST_FURNACE:
case SMOKER:
case BURNING_FURNACE:
searchFurnace(block, Deadbolt.getConfig().group_furnaces, Deadbolt.getConfig().group_furnaces);
break;
case TRAPPED_CHEST:
case CHEST:
case BARREL:
case SHULKER_BOX:
case WHITE_SHULKER_BOX:
case ORANGE_SHULKER_BOX:
case MAGENTA_SHULKER_BOX:
case LIGHT_BLUE_SHULKER_BOX:
case YELLOW_SHULKER_BOX:
case LIME_SHULKER_BOX:
case PINK_SHULKER_BOX:
case GRAY_SHULKER_BOX:
case LIGHT_GRAY_SHULKER_BOX:
case CYAN_SHULKER_BOX:
case PURPLE_SHULKER_BOX:
case BLUE_SHULKER_BOX:
case BROWN_SHULKER_BOX:
case GREEN_SHULKER_BOX:
case RED_SHULKER_BOX:
case BLACK_SHULKER_BOX:
searchChest(block, true, false);
break;
default:
Expand All @@ -97,13 +136,15 @@ private void search(Block block) {
Block adjacentUp = block.getRelative(BlockFace.UP);
switch (adjacentUp.getType()) {
// adjacentUp.getState().getData() instanceof Door no longer works for new doors
case WOODEN_DOOR:
case OAK_DOOR:
case IRON_DOOR_BLOCK:
case SPRUCE_DOOR:
case BIRCH_DOOR:
case JUNGLE_DOOR:
case ACACIA_DOOR:
case DARK_OAK_DOOR:
case WARPED_DOOR:
case CRIMSON_DOOR:
search(adjacentUp);
break;
}
Expand All @@ -117,6 +158,8 @@ private void search(Block block) {
case JUNGLE_DOOR:
case ACACIA_DOOR:
case DARK_OAK_DOOR:
case WARPED_DOOR:
case CRIMSON_DOOR:
search(adjacentDown);
break;
}
Expand Down Expand Up @@ -161,12 +204,14 @@ private void searchFenceGate(Block block, boolean horizontal, boolean vertical)
Block adjacent = block.getRelative(bf);
if (horizontal) {
switch (adjacent.getType()) {
case FENCE_GATE:
case OAK_FENCE_GATE:
case BIRCH_FENCE_GATE:
case ACACIA_FENCE_GATE:
case DARK_OAK_FENCE_GATE:
case JUNGLE_FENCE_GATE:
case SPRUCE_FENCE_GATE:
case WARPED_FENCE_GATE:
case CRIMSON_FENCE_GATE:
searchFenceGate(adjacent, horizontal, vertical);
break;
}
Expand All @@ -180,12 +225,14 @@ private void searchFenceGate(Block block, boolean horizontal, boolean vertical)
for (BlockFace bf : Deadbolt.getConfig().VERTICAL_FACES) {
Block adjacent = block.getRelative(bf);
switch (adjacent.getType()) {
case FENCE_GATE:
case OAK_FENCE_GATE:
case BIRCH_FENCE_GATE:
case ACACIA_FENCE_GATE:
case DARK_OAK_FENCE_GATE:
case JUNGLE_FENCE_GATE:
case SPRUCE_FENCE_GATE:
case WARPED_FENCE_GATE:
case CRIMSON_FENCE_GATE:
searchFenceGate(adjacent, horizontal, vertical);
break;
}
Expand Down Expand Up @@ -392,19 +439,19 @@ public void toggleDoors(Block block) {
Set<Block> clickedDoor = new HashSet<Block>();
if (isNaturalOpen(block)) {
// special case for Trap Doors so multiple sets don't get miss-aligned
if (block.getType() != Material.TRAP_DOOR)
if (block.getType() != Material.TRAPDOOR)
clickedDoor.add(block);
if (isVerticallyJoined(block)) {
Block b = block;
while ((b = b.getRelative(BlockFace.UP)).getType().equals(block.getType())
// special case for Trap Doors so it works vertically
&& b.getType() != Material.TRAP_DOOR) {
&& b.getType() != Material.TRAPDOOR) {
clickedDoor.add(b);
}
b = block;
while ((b = b.getRelative(BlockFace.DOWN)).getType().equals(block.getType())
// special case for Trap Doors so it works vertically
&& b.getType() != Material.TRAP_DOOR) {
&& b.getType() != Material.TRAPDOOR) {
clickedDoor.add(b);
}
}
Expand Down Expand Up @@ -463,6 +510,8 @@ private boolean isNaturalOpen(Block block) {
case JUNGLE_DOOR:
case ACACIA_DOOR:
case DARK_OAK_DOOR:
case WARPED_DOOR:
case CRIMSON_DOOR:
return true;
default:
return false;
Expand All @@ -478,8 +527,17 @@ private boolean isVerticallyJoined(Block block) {
case JUNGLE_DOOR:
case ACACIA_DOOR:
case DARK_OAK_DOOR:
case WARPED_DOOR:
case CRIMSON_DOOR:
return true;
case TRAP_DOOR:
case OAK_TRAPDOOR:
case BIRCH_TRAPDOOR:
case SPRUCE_TRAPDOOR:
case JUNGLE_TRAPDOOR:
case ACACIA_TRAPDOOR:
case DARK_OAK_TRAPDOOR:
case CRIMSON_TRAPDOOR:
case WARPED_TRAPDOOR:
case IRON_TRAPDOOR:
return Deadbolt.getConfig().vertical_trapdoors;
default:
Expand Down
Loading