/[projects]/miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/chests/SnitchingChest.java
ViewVC logotype

Diff of /miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/chests/SnitchingChest.java

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

revision 1773 by torben, Thu Apr 5 12:37:13 2012 UTC revision 1779 by torben, Thu Apr 5 14:27:24 2012 UTC
# Line 91  public class SnitchingChest  implements Line 91  public class SnitchingChest  implements
91                  }                  }
92                                    
93                  SnitchingChestBean chest1 = createChest(player.getName(), "", loc);                  SnitchingChestBean chest1 = createChest(player.getName(), "", loc);
                 //chestMap.put(loc, chest1);  
94                  addChest(loc, chest1);                  addChest(loc, chest1);
95                  if (loc2 != null) {                  if (loc2 != null) {
96                                                    
97                          SnitchingChestBean chest2 = createChest (player.getName(), "", loc2);                          SnitchingChestBean chest2 = createChest (player.getName(), "", loc2);
98                          addChest(loc, chest2);                          addChest(loc, chest2);
                         //chestMap.put(loc2, chest2 );  
99                  }                  }
100                    
101                  player.sendMessage("[SnitchingChest] Chest is now under surveillance");                  player.sendMessage("[SnitchingChest] Chest is now under surveillance");
# Line 127  public class SnitchingChest  implements Line 125  public class SnitchingChest  implements
125                    
126          void removeChest(Location loc) {          void removeChest(Location loc) {
127                  SnitchingChestBean chest = chestMap.remove(loc);                  SnitchingChestBean chest = chestMap.remove(loc);
128                  plugin.getDatabase().delete(chest);                  if (chest != null) {
129                            plugin.getDatabase().delete(chest);
130                    }
131          }          }
132                    
133          void loadChests() {                      void loadChests() {            
# Line 136  public class SnitchingChest  implements Line 136  public class SnitchingChest  implements
136                          Location loc = getChestLocation(server, chest);                          Location loc = getChestLocation(server, chest);
137                          chestMap.put(loc, chest);                                chestMap.put(loc, chest);      
138                  }                  }
139                    
140                    plugin.getLogger().info("[SnitchingChest] loaded " + chestMap.size() + " chests");
141          }          }
142                    
143                    
# Line 198  public class SnitchingChest  implements Line 200  public class SnitchingChest  implements
200                  } else {                  } else {
201                          loc =  ( (DoubleChest)holder).getLocation();                          loc =  ( (DoubleChest)holder).getLocation();
202                  }                  }
203                    
204                    loc.setX( loc.getBlockX() ); //round to integer, since double chests apparently are placed at pos + 0.5
205                    loc.setZ( loc.getBlockZ() ); // -- // --
206                    
207                  return loc;                  return loc;
208          }          }
209                    
# Line 241  public class SnitchingChest  implements Line 247  public class SnitchingChest  implements
247                  if (holder instanceof Chest || holder instanceof DoubleChest) {                  if (holder instanceof Chest || holder instanceof DoubleChest) {
248                          Location loc = getChestLocation(holder);                          Location loc = getChestLocation(holder);
249                          SnitchingChestBean chest = chestMap.get(loc);                          SnitchingChestBean chest = chestMap.get(loc);
250                            
251                            if (chest == null) { //chest was not a snitching chest
252                                    return;
253                            }
254                            
255                          OfflinePlayer owner = server.getOfflinePlayer( chest.getOwner() );                          OfflinePlayer owner = server.getOfflinePlayer( chest.getOwner() );
256                                                    
257                                                    

Legend:
Removed from v.1773  
changed lines
  Added in v.1779

  ViewVC Help
Powered by ViewVC 1.1.20