--- 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 2012/01/27 12:21:27 1684 @@ -18,8 +18,8 @@ private Location blocks[][]; // [width][height] - [0][0] == leftUpper - - private int material; + private int material[][]; + private byte data[][]; private int direction; @@ -27,17 +27,20 @@ private int height; private String owner; + + private boolean isPrivate; - 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) throws ConflictingDoorException{ leftUpper = sign.getLocation().clone(); this.width = width; this.height = height; this.owner = owner; + + this.isPrivate = isPrivate; - blocks = new Location[width][height]; direction = sign.getData() - 2; @@ -58,7 +61,7 @@ - material = leftUpper.getBlock().getTypeId(); + //material = leftUpper.getBlock().getTypeId(); loadBlocks(); @@ -74,6 +77,8 @@ } +/* + @Deprecated public Door(String input, Server server) { String parts[] = input.split(":"); @@ -81,27 +86,54 @@ 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) { + leftUpper = loc; + this.direction = direction; + this.width = width; + this.height = height; + this.owner = owner; + this.isPrivate = isPrivate; + + 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,7 +207,7 @@ } - public void open(World world) { + public void open() { for (int w=0; w