1
0
mirror of https://e.coding.net/circlecloud/QuickShop.git synced 2024-11-23 02:08:55 +00:00

fix load shop while Chunk unload error...

Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
j502647092 2015-10-07 14:58:16 +08:00
parent 3bcee64220
commit 6532d6f546

View File

@ -272,7 +272,7 @@ public class QuickShop extends JavaPlugin {
final double price = rs.getDouble("price"); final double price = rs.getDouble("price");
final Location loc = new Location(world, x, y, z); final Location loc = new Location(world, x, y, z);
/* Skip invalid shops, if we know of any */ /* Skip invalid shops, if we know of any */
if (world != null && (loc.getBlock().getState() instanceof InventoryHolder) == false) { if (world != null && loc.getChunk().isLoaded() && (loc.getBlock().getState() instanceof InventoryHolder) == false) {
getLogger().info("商店不是一个可存储的方块 坐标 " + rs.getString("world") + " at: " + x + ", " + y + ", " + z + ". 删除..."); getLogger().info("商店不是一个可存储的方块 坐标 " + rs.getString("world") + " at: " + x + ", " + y + ", " + z + ". 删除...");
final PreparedStatement delps = getDB().getConnection().prepareStatement("DELETE FROM shops WHERE x = ? AND y = ? and z = ? and world = ?"); final PreparedStatement delps = getDB().getConnection().prepareStatement("DELETE FROM shops WHERE x = ? AND y = ? and z = ? and world = ?");
delps.setInt(1, x); delps.setInt(1, x);
@ -291,6 +291,8 @@ public class QuickShop extends JavaPlugin {
shop.onLoad(); shop.onLoad();
} }
count++; count++;
} catch (final IllegalStateException e) {
getLogger().warning("商店区块未载入 跳过商店载入...");
} catch (final Exception e) { } catch (final Exception e) {
errors++; errors++;
e.printStackTrace(); e.printStackTrace();