mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-01 07:03:26 +01:00
Merge pull request #2474 from DinoFengz/patch-1
Update RemoveMobsListener.java
This commit is contained in:
commit
6cbbdad34e
@ -24,17 +24,22 @@ public class RemoveMobsListener extends FlagListener {
|
|||||||
|| e.getCause().equals(TeleportCause.SPECTATE)) {
|
|| e.getCause().equals(TeleportCause.SPECTATE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(e.getTo() != null) {
|
||||||
// Return if this is a small teleport
|
// Return if this is a small teleport
|
||||||
if (e.getTo().getWorld().equals(e.getPlayer().getWorld()) &&
|
if (e.getTo().getWorld().equals(e.getPlayer().getWorld()) &&
|
||||||
e.getTo().distanceSquared(e.getPlayer().getLocation()) < getPlugin().getSettings().getClearRadius() * getPlugin().getSettings().getClearRadius()) {
|
e.getTo().distanceSquared(e.getPlayer().getLocation()) < getPlugin().getSettings().getClearRadius() * getPlugin().getSettings().getClearRadius()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only process if flag is active
|
// Only process if flag is active
|
||||||
if (getIslands().locationIsOnIsland(e.getPlayer(), e.getTo()) && Flags.REMOVE_MOBS.isSetForWorld(e.getTo().getWorld())) {
|
if (getIslands().locationIsOnIsland(e.getPlayer(), e.getTo()) && Flags.REMOVE_MOBS.isSetForWorld(e.getTo().getWorld())) {
|
||||||
Bukkit.getScheduler().runTask(getPlugin(), () -> getIslands().clearArea(e.getTo()));
|
Bukkit.getScheduler().runTask(getPlugin(), () -> getIslands().clearArea(e.getTo()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onUserRespawn(PlayerRespawnEvent e) {
|
public void onUserRespawn(PlayerRespawnEvent e) {
|
||||||
// Only process if flag is active
|
// Only process if flag is active
|
||||||
|
Loading…
Reference in New Issue
Block a user