/[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 1535 by torben, Wed Jun 29 14:57:08 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    
30          public Door(Block sign) {          public Door(Block sign, int width, int height, DoorStorage store) throws ConflictingDoorException{
31                  leftUpper = sign.getLocation().clone();                  leftUpper = sign.getLocation().clone();
32                                    
33                    this.width = width;
34                    this.height = height;
35                    
36                    blocks = new Location[width][height];          
37    
38                  direction = sign.getData() - 2;                  direction = sign.getData() - 2;
39                                    
# Line 53  class Door { Line 57  class Door {
57                  material = leftUpper.getBlock().getTypeId();                  material = leftUpper.getBlock().getTypeId();
58                                    
59                  loadBlocks();                  loadBlocks();
60                    
61                    
62                    for (int w=0; w<width; w++) {
63                            for (int h=0; h<height; h++) {
64                                    Door d = store.findDoor( blocks[w][h] );
65                                    if (d != null) {
66                                            throw new ConflictingDoorException();
67                                    }
68                            }
69                    }
70    
71          }          }
72    
# Line 64  class Door { Line 78  class Door {
78                  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]) );
79                  direction = Integer.parseInt( parts[4] );                  direction = Integer.parseInt( parts[4] );
80                  material = Integer.parseInt( parts[5] );                  material = Integer.parseInt( parts[5] );
81                    
82                    width = Integer.parseInt( parts[6] );
83                    height = Integer.parseInt( parts[7] );
84    
85    
86                    blocks = new Location[width][height];          
87                    
88                  loadBlocks();                  loadBlocks();
89          }          }
90                    
# Line 111  class Door { Line 132  class Door {
132                                    
133                  sb.append( ":" + direction );                  sb.append( ":" + direction );
134    
   
135                  sb.append( ":" + material );                  sb.append( ":" + material );
136                    
137                    sb.append( ":" + width );
138                    sb.append( ":" + height );
139    
140                  return sb.toString();                  return sb.toString();
141          }          }
# Line 152  class Door { Line 175  class Door {
175                  }                  }
176          }          }
177    
 }  
178    }

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

  ViewVC Help
Powered by ViewVC 1.1.20