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"); |
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() { |
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 |
|
|
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 |
|
|
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 |
|
|