Merge pull request #2474 from DinoFengz/patch-1

Update RemoveMobsListener.java
This commit is contained in:
tastybento 2024-08-20 22:25:01 -07:00 committed by GitHub
commit 6cbbdad34e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,15 +24,20 @@ public class RemoveMobsListener extends FlagListener {
|| e.getCause().equals(TeleportCause.SPECTATE)) { || e.getCause().equals(TeleportCause.SPECTATE)) {
return; return;
} }
// Return if this is a small teleport
if (e.getTo().getWorld().equals(e.getPlayer().getWorld()) && if(e.getTo() != null) {
e.getTo().distanceSquared(e.getPlayer().getLocation()) < getPlugin().getSettings().getClearRadius() * getPlugin().getSettings().getClearRadius()) { // Return if this is a small teleport
return; if (e.getTo().getWorld().equals(e.getPlayer().getWorld()) &&
} e.getTo().distanceSquared(e.getPlayer().getLocation()) < getPlugin().getSettings().getClearRadius() * getPlugin().getSettings().getClearRadius()) {
// Only process if flag is active return;
if (getIslands().locationIsOnIsland(e.getPlayer(), e.getTo()) && Flags.REMOVE_MOBS.isSetForWorld(e.getTo().getWorld())) { }
Bukkit.getScheduler().runTask(getPlugin(), () -> getIslands().clearArea(e.getTo()));
// Only process if flag is active
if (getIslands().locationIsOnIsland(e.getPlayer(), e.getTo()) && Flags.REMOVE_MOBS.isSetForWorld(e.getTo().getWorld())) {
Bukkit.getScheduler().runTask(getPlugin(), () -> getIslands().clearArea(e.getTo()));
}
} }
} }
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)