From 19e4b2b678f3094ce6cd22f8b7e55d565a22ee4d Mon Sep 17 00:00:00 2001 From: Kai Date: Tue, 13 Jun 2017 00:09:55 +0200 Subject: [PATCH] Suppressing all exceptions caused by InventoryCloseEvent These are caused by bad implementations not related to QuickShop, but exceptions are annoying. --- .../quickshop/Listeners/PlayerListener.java | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/Listeners/PlayerListener.java b/src/main/java/org/maxgamer/quickshop/Listeners/PlayerListener.java index 0da7e04c0..ae5f579ec 100644 --- a/src/main/java/org/maxgamer/quickshop/Listeners/PlayerListener.java +++ b/src/main/java/org/maxgamer/quickshop/Listeners/PlayerListener.java @@ -204,21 +204,25 @@ public class PlayerListener implements Listener { @EventHandler public void onInventoryClose(InventoryCloseEvent e) { - final Inventory inventory = e.getInventory(); - if (inventory == null) { - return; + try { + final Inventory inventory = e.getInventory(); + if (inventory == null) { + return; + } + + final Location location = inventory.getLocation(); + if (location == null) { + return; + } + + final Shop shop = plugin.getShopManager().getShop(location); + if (shop == null) { + return; + } + + shop.setSignText(); + } catch (Throwable t) { + } - - final Location location = inventory.getLocation(); - if (location == null) { - return; - } - - final Shop shop = plugin.getShopManager().getShop(location); - if (shop == null) { - return; - } - - shop.setSignText(); } }