Added 1.8 Fences

This commit is contained in:
Sn0wStorm 2015-01-10 22:51:01 +01:00
parent bc56fc8770
commit 1f16c6af04
5 changed files with 36 additions and 9 deletions

11
pom.xml
View File

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

View File

@ -342,6 +342,12 @@ public class Barrel implements InventoryHolder {
case NETHER_FENCE: case NETHER_FENCE:
case SIGN_POST: case SIGN_POST:
case WALL_SIGN: 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); Barrel barrel = getBySpigot(block);
if (barrel != null) { if (barrel != null) {
return barrel; return barrel;
@ -697,7 +703,7 @@ public class Barrel implements InventoryHolder {
while (y <= 1) { while (y <= 1) {
// Fence and Netherfence // Fence and Netherfence
Block relative = block.getRelative(0, y, 0); Block relative = block.getRelative(0, y, 0);
if (relative.getType() == Material.FENCE || relative.getType() == Material.NETHER_FENCE) { if (isFence(relative.getType())) {
return (relative); return (relative);
} }
y++; 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 // returns null if Barrel is correctly placed; the block that is missing when not
// the barrel needs to be formed correctly // the barrel needs to be formed correctly
// flag force to also check if chunk is not loaded // flag force to also check if chunk is not loaded

View File

@ -645,6 +645,12 @@ public class P extends JavaPlugin {
return true; return true;
case FENCE: case FENCE:
case NETHER_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 // remove barrel and throw potions on the ground
Barrel barrel = Barrel.getBySpigot(block); Barrel barrel = Barrel.getBySpigot(block);
if (barrel != null) { if (barrel != null) {

View File

@ -21,7 +21,7 @@ import org.json.simple.JSONValue;
*/ */
public class UpdateChecker implements Runnable { public class UpdateChecker implements Runnable {
// The project's unique ID // The project's unique ID
private final int projectID = 68006; private static final int projectID = 68006;
// Used for locating version numbers in file names // Used for locating version numbers in file names
private static final String DELIMETER = "^v|[\\s_-]v"; private static final String DELIMETER = "^v|[\\s_-]v";

View File

@ -119,7 +119,7 @@ public class PlayerListener implements Listener {
break; 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); barrel = Barrel.getBySpigot(clickedBlock);
} }