--- miscJava/bukkit-minecraft-plugins/HoerupUtils/src/dk/thoerup/bukkit/hoeruputils/secretdoor/Door.java 2011/07/16 11:01:02 1578 +++ miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/secretdoor/Door.java 2013/01/13 13:05:16 1912 @@ -2,6 +2,7 @@ import java.util.Map; +import org.bukkit.Material; import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.World; @@ -18,8 +19,8 @@ private Location blocks[][]; // [width][height] - [0][0] == leftUpper - - private int material; + private int material[][]; + private byte data[][]; private int direction; @@ -27,17 +28,23 @@ private int height; private String owner; + + private boolean isPrivate; + + private String password; - public Door(Block sign, int width, int height, DoorStorage store, String owner) throws ConflictingDoorException{ + public Door(Block sign, int width, int height, DoorStorage store, String owner, boolean isPrivate, String password) throws ConflictingDoorException{ leftUpper = sign.getLocation().clone(); this.width = width; this.height = height; this.owner = owner; + + this.isPrivate = isPrivate; + this.password = password; - blocks = new Location[width][height]; direction = sign.getData() - 2; @@ -58,7 +65,7 @@ - material = leftUpper.getBlock().getTypeId(); + //material = leftUpper.getBlock().getTypeId(); loadBlocks(); @@ -74,6 +81,8 @@ } +/* + @Deprecated public Door(String input, Server server) { String parts[] = input.split(":"); @@ -81,27 +90,55 @@ leftUpper = new Location(w, Integer.parseInt(parts[1]), Integer.parseInt(parts[2]), Integer.parseInt(parts[3]) ); direction = Integer.parseInt( parts[4] ); - material = Integer.parseInt( parts[5] ); + //material = Integer.parseInt( parts[5] ); width = Integer.parseInt( parts[6] ); height = Integer.parseInt( parts[7] ); owner = parts[8]; - - blocks = new Location[width][height]; loadBlocks(); + }*/ + + public Door(Location loc, int direction, int width, int height, String owner, boolean isPrivate, String password) { + leftUpper = loc; + this.direction = direction; + this.width = width; + this.height = height; + this.owner = owner; + this.isPrivate = isPrivate; + this.password = password; + + loadBlocks(); } + + public void powerChange(World world, int oldCurrent, int newCurrent ) { - if (newCurrent != 0) { - open(world); + if (isPowered() == true) { + open(); } else { - close(world); + close(); } } + + public boolean isPowered() { + for (int w=0; w map) { @@ -172,19 +212,20 @@ } - public void open(World world) { + public void open() { for (int w=0; w