From 1f16c6af04dd1a34779dd3ab6385866112f41b98 Mon Sep 17 00:00:00 2001 From: Sn0wStorm Date: Sat, 10 Jan 2015 22:51:01 +0100 Subject: [PATCH] Added 1.8 Fences --- pom.xml | 11 ++++----- src/com/dre/brewery/Barrel.java | 24 ++++++++++++++++++- src/com/dre/brewery/P.java | 6 +++++ .../dre/brewery/filedata/UpdateChecker.java | 2 +- .../dre/brewery/listeners/PlayerListener.java | 2 +- 5 files changed, 36 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 1cb3acb..a883d54 100644 --- a/pom.xml +++ b/pom.xml @@ -65,8 +65,8 @@ - bukkit-repo - http://repo.bukkit.org/content/groups/public/ + spigot-repo + https://hub.spigotmc.org/nexus/content/groups/public/ true always @@ -110,10 +110,9 @@ - org.bukkit - bukkit - 1.7.9-R0.2 - provided + org.spigotmc + spigot-api + 1.8-R0.1-SNAPSHOT diff --git a/src/com/dre/brewery/Barrel.java b/src/com/dre/brewery/Barrel.java index a44e51c..4e79dbc 100644 --- a/src/com/dre/brewery/Barrel.java +++ b/src/com/dre/brewery/Barrel.java @@ -342,6 +342,12 @@ public class Barrel implements InventoryHolder { 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; @@ -697,7 +703,7 @@ public class Barrel implements InventoryHolder { 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++; @@ -719,6 +725,22 @@ public class Barrel implements InventoryHolder { } } + 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 diff --git a/src/com/dre/brewery/P.java b/src/com/dre/brewery/P.java index 131ec72..4477205 100644 --- a/src/com/dre/brewery/P.java +++ b/src/com/dre/brewery/P.java @@ -645,6 +645,12 @@ public class P extends JavaPlugin { 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) { diff --git a/src/com/dre/brewery/filedata/UpdateChecker.java b/src/com/dre/brewery/filedata/UpdateChecker.java index 947967b..7fef06c 100644 --- a/src/com/dre/brewery/filedata/UpdateChecker.java +++ b/src/com/dre/brewery/filedata/UpdateChecker.java @@ -21,7 +21,7 @@ import org.json.simple.JSONValue; */ 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"; diff --git a/src/com/dre/brewery/listeners/PlayerListener.java b/src/com/dre/brewery/listeners/PlayerListener.java index 49c7123..e964cb1 100644 --- a/src/com/dre/brewery/listeners/PlayerListener.java +++ b/src/com/dre/brewery/listeners/PlayerListener.java @@ -119,7 +119,7 @@ public class PlayerListener implements Listener { 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); }