Skip to content

Commit

Permalink
Added 1.8 Fences
Browse files Browse the repository at this point in the history
  • Loading branch information
Sn0wStorm committed Jan 10, 2015
1 parent bc56fc8 commit 1f16c6a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 9 deletions.
11 changes: 5 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@

<repositories>
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
Expand Down Expand Up @@ -110,10 +110,9 @@
<dependencies>
<!-- Provided by third-party -->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.7.9-R0.2</version>
<scope>provided</scope>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8-R0.1-SNAPSHOT</version>
</dependency>

<dependency>
Expand Down
24 changes: 23 additions & 1 deletion src/com/dre/brewery/Barrel.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,12 @@ public static Barrel get(Block block) {
case NETHER_FENCE:
case SIGN_POST:
case WALL_SIGN:
case ACACIA_FENCE:
case BIRCH_FENCE:
case DARK_OAK_FENCE:
case IRON_FENCE:
case JUNGLE_FENCE:
case SPRUCE_FENCE:
Barrel barrel = getBySpigot(block);
if (barrel != null) {
return barrel;
Expand Down Expand Up @@ -697,7 +703,7 @@ public static Block getSpigotOfSign(Block block) {
while (y <= 1) {
// Fence and Netherfence
Block relative = block.getRelative(0, y, 0);
if (relative.getType() == Material.FENCE || relative.getType() == Material.NETHER_FENCE) {
if (isFence(relative.getType())) {
return (relative);
}
y++;
Expand All @@ -719,6 +725,22 @@ public static boolean isStairs(Material material) {
}
}

public static boolean isFence(Material material) {
switch (material) {
case FENCE:
case NETHER_FENCE:
case ACACIA_FENCE:
case BIRCH_FENCE:
case DARK_OAK_FENCE:
case IRON_FENCE:
case JUNGLE_FENCE:
case SPRUCE_FENCE:
return true;
default:
return false;
}
}

// returns null if Barrel is correctly placed; the block that is missing when not
// the barrel needs to be formed correctly
// flag force to also check if chunk is not loaded
Expand Down
6 changes: 6 additions & 0 deletions src/com/dre/brewery/P.java
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,12 @@ public boolean blockDestroy(Block block, Player player) {
return true;
case FENCE:
case NETHER_FENCE:
case ACACIA_FENCE:
case BIRCH_FENCE:
case DARK_OAK_FENCE:
case IRON_FENCE:
case JUNGLE_FENCE:
case SPRUCE_FENCE:
// remove barrel and throw potions on the ground
Barrel barrel = Barrel.getBySpigot(block);
if (barrel != null) {
Expand Down
2 changes: 1 addition & 1 deletion src/com/dre/brewery/filedata/UpdateChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
public class UpdateChecker implements Runnable {
// The project's unique ID
private final int projectID = 68006;
private static final int projectID = 68006;

// Used for locating version numbers in file names
private static final String DELIMETER = "^v|[\\s_-]v";
Expand Down
2 changes: 1 addition & 1 deletion src/com/dre/brewery/listeners/PlayerListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void onPlayerInteract(PlayerInteractEvent event) {
break;
}
}
} else if (type == Material.FENCE || type == Material.NETHER_FENCE || type == Material.SIGN_POST || type == Material.WALL_SIGN) {
} else if (Barrel.isFence(type) || type == Material.SIGN_POST || type == Material.WALL_SIGN) {
barrel = Barrel.getBySpigot(clickedBlock);
}

Expand Down

0 comments on commit 1f16c6a

Please sign in to comment.