diff --git a/src/com/wasteofplastic/askyblock/GridManager.java b/src/com/wasteofplastic/askyblock/GridManager.java index 4eed9c1c7..79c9e326c 100644 --- a/src/com/wasteofplastic/askyblock/GridManager.java +++ b/src/com/wasteofplastic/askyblock/GridManager.java @@ -1309,6 +1309,24 @@ public void homeSet(Player player, int number) { public void homeSet(final Player player) { homeSet(player, 1); } + + /** + * Checks if a player is in their full island space + * @param player + * @return true if they are anywhere inside their island space (not just protected area) + */ + public boolean inIslandSpace(Player player) { + if (player == null) { + return false; + } + Island island = getIslandAt(player.getLocation()); + if (island != null) { + if (island.inIslandSpace(player.getLocation()) && island.getMembers().contains(player.getUniqueId())) { + return true; + } + } + return false; + } /** * Checks if a specific location is within the protected range of an island diff --git a/src/com/wasteofplastic/askyblock/listeners/PlayerEvents.java b/src/com/wasteofplastic/askyblock/listeners/PlayerEvents.java index fa98fcf71..cc722dfda 100644 --- a/src/com/wasteofplastic/askyblock/listeners/PlayerEvents.java +++ b/src/com/wasteofplastic/askyblock/listeners/PlayerEvents.java @@ -931,7 +931,7 @@ public void onVisitorGetDamage(EntityDamageEvent e){ // Entity attacks are handled elsewhere if (e.getCause().equals(DamageCause.ENTITY_ATTACK)) return; Player p = (Player) e.getEntity(); - if (!IslandGuard.inWorld(p) || plugin.getGrid().locationIsOnIsland(p, p.getLocation())) return; + if (!IslandGuard.inWorld(p) || plugin.getGrid().inIslandSpace(p)) return; if (Settings.visitorDamagePrevention.contains(e.getCause())) e.setCancelled(true);