Skip to content

Commit

Permalink
Fixes exploit where players can avoid death by falling.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed May 5, 2018
1 parent 5513465 commit e37a662
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/com/wasteofplastic/askyblock/GridManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit e37a662

Please sign in to comment.