From 7a74e88cd165a500b16d83a302b588eb4b4916cb Mon Sep 17 00:00:00 2001 From: 17jiong <17jiong@gmail.com> Date: Mon, 29 Jan 2018 02:58:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A9=E4=BF=AE=E6=94=B9=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?=E7=AD=89=E8=A1=8C=E4=B8=BA=E5=BC=82=E6=AD=A5=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QuickShop/Shop/ContainerShop.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/maxgamer/QuickShop/Shop/ContainerShop.java b/src/main/java/org/maxgamer/QuickShop/Shop/ContainerShop.java index eb742c6..88998a1 100644 --- a/src/main/java/org/maxgamer/QuickShop/Shop/ContainerShop.java +++ b/src/main/java/org/maxgamer/QuickShop/Shop/ContainerShop.java @@ -656,13 +656,22 @@ public class ContainerShop implements Shop { final String world = this.getLocation().getWorld().getName(); final int unlimited = this.isUnlimited() ? 1 : 0; final String q = "UPDATE shops SET owner = ?, itemConfig = ?, unlimited = ?, type = ?, price = ? WHERE x = ? AND y = ? and z = ? and world = ?"; - try { - plugin.getDB().execute(q, this.getOwner(), Util.serialize(this.getItem()), unlimited, shopType.toID(), this.getPrice(), x, y, z, world); - } catch (final Exception e) { - plugin.getLogger().warning("无法保存商店到数据库!!!"); - plugin.getLogger().warning("错误信息: " + e.getMessage()); - e.printStackTrace(); - } + final String owner = this.getOwner(); + final String item = Util.serialize(this.getItem()); + double price = this.getPrice(); + // Async database execute + plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { + @Override + public void run() { + try { + plugin.getDB().execute(q, owner, item, unlimited, shopType.toID(), price, x, y, z, world); + } catch (final Exception e) { + plugin.getLogger().warning("无法保存商店到数据库!!!"); + plugin.getLogger().warning("错误信息: " + e.getMessage()); + e.printStackTrace(); + } + } + }); } private void checkDisplay() {