Removed unused LoE specific component
parent
a695ca86b2
commit
dd1992e99c
@ -1,76 +0,0 @@
|
|||||||
package com.zivilon.dungeontools.listeners;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
|
||||||
|
|
||||||
public class barrow_wight_teleport_listener implements Listener {
|
|
||||||
|
|
||||||
// Target teleport location
|
|
||||||
private final Location teleport_location = new Location(
|
|
||||||
Bukkit.getWorld("DIM100"), // Change to your actual world name
|
|
||||||
-100203.5,
|
|
||||||
108.0,
|
|
||||||
46030.5
|
|
||||||
);
|
|
||||||
|
|
||||||
// Bounding box of the area from where the Barrow-wight should not be teleported
|
|
||||||
private final Location corner_1 = new Location(
|
|
||||||
teleport_location.getWorld(),
|
|
||||||
-100227,
|
|
||||||
90,
|
|
||||||
46021
|
|
||||||
);
|
|
||||||
|
|
||||||
private final Location corner_2 = new Location(
|
|
||||||
teleport_location.getWorld(),
|
|
||||||
-100173,
|
|
||||||
150,
|
|
||||||
46052
|
|
||||||
);
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
|
||||||
Entity entity = event.getEntity();
|
|
||||||
|
|
||||||
if (entity.getType() == EntityType.valueOf("LOTR_BARROWWIGHT")) { // Change to the actual EntityType name
|
|
||||||
Location entity_location = entity.getLocation();
|
|
||||||
|
|
||||||
if (Math.abs(entity_location.getX() - teleport_location.getX()) <= 200 &&
|
|
||||||
Math.abs(entity_location.getZ() - teleport_location.getZ()) <= 200) {
|
|
||||||
|
|
||||||
if (isOutsideBox(entity_location, corner_1, corner_2)) {
|
|
||||||
if (entity instanceof LivingEntity) {
|
|
||||||
LivingEntity livingEntity = (LivingEntity) entity;
|
|
||||||
|
|
||||||
// Heal the entity to max health
|
|
||||||
livingEntity.setHealth(livingEntity.getMaxHealth());
|
|
||||||
}
|
|
||||||
event.setCancelled(true);
|
|
||||||
entity.teleport(teleport_location);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isOutsideBox(Location point, Location corner_1, Location corner_2) {
|
|
||||||
boolean return_value = false;
|
|
||||||
if (point.getX() < corner_1.getX() || point.getX() > corner_2.getX()) {
|
|
||||||
return_value = true;
|
|
||||||
}
|
|
||||||
if (point.getY() < corner_1.getY() || point.getY() > corner_2.getY()) {
|
|
||||||
return_value = true;
|
|
||||||
}
|
|
||||||
if (point.getZ() < corner_1.getZ() || point.getZ() > corner_2.getZ()) {
|
|
||||||
return_value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return return_value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue