From a92bd9292e47eccf817767bf7cf16a2f8925ef90 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 8 Jun 2017 21:57:30 +0200 Subject: [PATCH] Fixed NPE while creating shop on an unowned ASkyBlock island --- .../shopchest/listeners/ShopInteractListener.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java index d2dbe02..2bca586 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java @@ -240,8 +240,13 @@ public class ShopInteractListener implements Listener { if (loc != null) { Island island = ASkyBlockAPI.getInstance().getIslandAt(loc); if (island != null) { - plugin.debug("Chest is on island of " + Bukkit.getOfflinePlayer(island.getOwner()).getName()); - externalPluginsAllowed &= island.getMembers().contains(p.getUniqueId()) || island.getOwner().equals(p.getUniqueId()); + if (island.getOwner() == null) { + plugin.debug("Chest is on an unowned island."); + externalPluginsAllowed &= island.getMembers().contains(p.getUniqueId()); + } else { + plugin.debug("Chest is on island of " + Bukkit.getOfflinePlayer(island.getOwner()).getName()); + externalPluginsAllowed &= island.getMembers().contains(p.getUniqueId()) || island.getOwner().equals(p.getUniqueId()); + } } } }