Fixed NPE while creating shop on an unowned ASkyBlock island

This commit is contained in:
Eric 2017-06-08 21:57:30 +02:00
parent f6eb2948b5
commit a92bd9292e
1 changed files with 7 additions and 2 deletions

View File

@ -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());
}
}
}
}