Disable void falling and entity damage
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
cadc5854ef
commit
2de28d64a5
@ -6,6 +6,7 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
@ -58,4 +59,10 @@ public class PlayerChecker implements Listener
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDamage(EntityDamageEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,13 @@ public class LocationCheckRunnable implements Runnable
|
||||
islandSpawnCoordinates.setX(islandSpawnCoordinates.getX() + spawnOffsetX);
|
||||
islandSpawnCoordinates.setZ(islandSpawnCoordinates.getZ() + spawnOffsetZ);
|
||||
|
||||
// boolean to know if after the different checks we have to teleport the player
|
||||
boolean teleport = false;
|
||||
|
||||
// check if player is free-falling into the void
|
||||
if(playerLocation.getBlockY() <= playerLocation.getWorld().getMinHeight())
|
||||
teleport = true;
|
||||
|
||||
|
||||
// calculate absolute distance from spawnpoint
|
||||
int distanceX = Math.abs(playerLocation.getBlockX() - islandSpawnCoordinates.getX());
|
||||
@ -61,11 +68,12 @@ public class LocationCheckRunnable implements Runnable
|
||||
|
||||
// check if player is inside bounds
|
||||
if(distanceX > Cache.islandWalkingRange || distanceZ > Cache.islandWalkingRange)
|
||||
teleport = true;
|
||||
|
||||
if(teleport)
|
||||
{
|
||||
LocationUtils.teleportToOwnIsland(player);
|
||||
player.sendMessage("Out of bounds");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user