35 |
|
|
36 |
import dk.thoerup.bukkit.hoeruputils.HoerupUtilsPlugin; |
import dk.thoerup.bukkit.hoeruputils.HoerupUtilsPlugin; |
37 |
import dk.thoerup.bukkit.hoeruputils.Util; |
import dk.thoerup.bukkit.hoeruputils.Util; |
38 |
|
import io.ebean.Ebean; |
39 |
|
|
40 |
|
|
41 |
|
|
54 |
HoerupUtilsPlugin plugin; |
HoerupUtilsPlugin plugin; |
55 |
Server server; |
Server server; |
56 |
|
|
57 |
public AdvancedChest(HoerupUtilsPlugin plugin, Runnable r) { |
public AdvancedChest(HoerupUtilsPlugin plugin) { |
58 |
this.plugin = plugin; |
this.plugin = plugin; |
59 |
server = plugin.getServer(); |
server = plugin.getServer(); |
60 |
try { |
try { |
192 |
return true; |
return true; |
193 |
} |
} |
194 |
chest.setOwner( p2.getName() ); |
chest.setOwner( p2.getName() ); |
195 |
plugin.getDatabase().save( chest ); |
Ebean.getDefaultServer().save( chest ); |
196 |
player.sendMessage("ok"); |
player.sendMessage("ok"); |
197 |
return true; |
return true; |
198 |
} |
} |
227 |
} |
} |
228 |
|
|
229 |
chest.setModifyPlayers( Util.setToString(players) ); |
chest.setModifyPlayers( Util.setToString(players) ); |
230 |
plugin.getDatabase().save( chest ); |
Ebean.getDefaultServer().save( chest ); |
231 |
player.sendMessage("ok"); |
player.sendMessage("ok"); |
232 |
return true; |
return true; |
233 |
} |
} |
249 |
String comment = sb.toString().trim(); |
String comment = sb.toString().trim(); |
250 |
|
|
251 |
chest.setComment( comment ); |
chest.setComment( comment ); |
252 |
plugin.getDatabase().save( chest ); |
Ebean.getDefaultServer().save( chest ); |
253 |
player.sendMessage("Comment set"); |
player.sendMessage("Comment set"); |
254 |
|
|
255 |
return true; |
return true; |
304 |
Location loc2 = getNeighborChest(loc); |
Location loc2 = getNeighborChest(loc); |
305 |
chestMap.put(loc2, chest); |
chestMap.put(loc2, chest); |
306 |
} |
} |
307 |
plugin.getDatabase().save(chest); |
Ebean.getDefaultServer().save(chest); |
308 |
|
|
309 |
reloadChests(); |
reloadChests(); |
310 |
|
|
317 |
Location loc2 = getNeighborChest(loc); |
Location loc2 = getNeighborChest(loc); |
318 |
chestMap.remove(loc2); |
chestMap.remove(loc2); |
319 |
} |
} |
320 |
plugin.getDatabase().delete(chest); |
Ebean.getDefaultServer().delete(chest); |
321 |
} |
} |
322 |
} |
} |
323 |
|
|
324 |
int loadChestsWorker() { |
int loadChestsWorker() { |
325 |
List<ChestBean> chestlist = plugin.getDatabase().find( ChestBean.class).findList(); |
List<ChestBean> chestlist = Ebean.getDefaultServer().find( ChestBean.class).findList(); |
326 |
for (ChestBean chest : chestlist) { |
for (ChestBean chest : chestlist) { |
327 |
Location loc = getChestLocation(server, chest); |
Location loc = getChestLocation(server, chest); |
328 |
chestMap.put(loc, chest); |
chestMap.put(loc, chest); |