1
0
mirror of https://e.coding.net/circlecloud/QuickShop.git synced 2024-11-21 01:48:54 +00:00

异步调用数据库删除方法(BlockBreakEvent触发)

This commit is contained in:
17jiong 2018-01-29 01:15:51 +08:00
parent 4f3ee83b47
commit 4b41bdff57

View File

@ -195,7 +195,13 @@ public class ContainerShop implements Shop {
final int y = this.getLocation().getBlockY();
final int z = this.getLocation().getBlockZ();
final String world = this.getLocation().getWorld().getName();
plugin.getDB().execute("DELETE FROM shops WHERE x = '" + x + "' AND y = '" + y + "' AND z = '" + z + "' AND world = '" + world + "'");
// Async database execute
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
plugin.getDB().execute("DELETE FROM shops WHERE x = '" + x + "' AND y = '" + y + "' AND z = '" + z + "' AND world = '" + world + "'");
}
});
// Refund if necessary
if (plugin.getConfig().getBoolean("shop.refund")) {
plugin.getEcon().deposit(this.getOwner(), plugin.getConfig().getDouble("shop.cost"));