/[projects]/miscJava/bukkit-minecraft-plugins/HoerupUtils/src/dk/thoerup/bukkit/hoeruputils/secretdoor/Door.java
ViewVC logotype

Diff of /miscJava/bukkit-minecraft-plugins/HoerupUtils/src/dk/thoerup/bukkit/hoeruputils/secretdoor/Door.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1532 by torben, Mon Jun 27 18:10:05 2011 UTC revision 1536 by torben, Wed Jun 29 17:19:38 2011 UTC
# Line 17  class Door { Line 17  class Door {
17          Location leftUpper;          Location leftUpper;
18    
19                    
20          Location blocks[][] = new Location[2][2]; // [width][height] - [0][0] == leftUpper          Location blocks[][]; // [width][height] - [0][0] == leftUpper
21    
22          int material;          int material;
23                    
24          int direction;          int direction;
25                    
26          int width = 2;          int width;
27          int height = 2;          int height;
28    
29            String owner;
30                    
31    
32          public Door(Block sign) {          public Door(Block sign, int width, int height, DoorStorage store, String owner) throws ConflictingDoorException{
33                  leftUpper = sign.getLocation().clone();                  leftUpper = sign.getLocation().clone();
34                                    
35                    this.width = width;
36                    this.height = height;
37    
38                    this.owner = owner;
39                    
40                    blocks = new Location[width][height];          
41    
42                  direction = sign.getData() - 2;                  direction = sign.getData() - 2;
43                                    
# Line 53  class Door { Line 61  class Door {
61                  material = leftUpper.getBlock().getTypeId();                  material = leftUpper.getBlock().getTypeId();
62                                    
63                  loadBlocks();                  loadBlocks();
64                    
65                    
66                    for (int w=0; w<width; w++) {
67                            for (int h=0; h<height; h++) {
68                                    Door d = store.findDoor( blocks[w][h] );
69                                    if (d != null) {
70                                            throw new ConflictingDoorException();
71                                    }
72                            }
73                    }
74    
75          }          }
76    
# Line 64  class Door { Line 82  class Door {
82                  leftUpper  = new Location(w, Integer.parseInt(parts[1]),  Integer.parseInt(parts[2]),  Integer.parseInt(parts[3]) );                  leftUpper  = new Location(w, Integer.parseInt(parts[1]),  Integer.parseInt(parts[2]),  Integer.parseInt(parts[3]) );
83                  direction = Integer.parseInt( parts[4] );                  direction = Integer.parseInt( parts[4] );
84                  material = Integer.parseInt( parts[5] );                  material = Integer.parseInt( parts[5] );
85                    
86                    width = Integer.parseInt( parts[6] );
87                    height = Integer.parseInt( parts[7] );
88                    owner = parts[8];
89    
90    
91                    blocks = new Location[width][height];          
92                    
93                  loadBlocks();                  loadBlocks();
94          }          }
95                    
# Line 111  class Door { Line 137  class Door {
137                                    
138                  sb.append( ":" + direction );                  sb.append( ":" + direction );
139    
   
140                  sb.append( ":" + material );                  sb.append( ":" + material );
141                    
142                    sb.append( ":" + width );
143                    sb.append( ":" + height );
144                    sb.append( ":" + owner);
145    
146                  return sb.toString();                  return sb.toString();
147          }          }
# Line 152  class Door { Line 181  class Door {
181                  }                  }
182          }          }
183    
 }  
184    }

Legend:
Removed from v.1532  
changed lines
  Added in v.1536

  ViewVC Help
Powered by ViewVC 1.1.20