3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-19 04:50:06 +01:00

Implemented EntityTeleportEvent. Fixes BUKKIT-366

Dieser Commit ist enthalten in:
craftycreeper 2012-02-07 23:49:07 -05:00 committet von EvilSeph
Ursprung be0ecf4670
Commit ad6bab8c6f

Datei anzeigen

@ -7,6 +7,7 @@ import org.bukkit.Location;
import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.entity.EndermanPickupEvent; import org.bukkit.event.entity.EndermanPickupEvent;
import org.bukkit.event.entity.EndermanPlaceEvent; import org.bukkit.event.entity.EndermanPlaceEvent;
import org.bukkit.event.entity.EntityTeleportEvent;
// CraftBukkit end // CraftBukkit end
public class EntityEnderman extends EntityMonster { public class EntityEnderman extends EntityMonster {
@ -229,10 +230,19 @@ public class EntityEnderman extends EntityMonster {
} }
if (flag1) { if (flag1) {
this.setPosition(this.locX, this.locY, this.locZ); // CraftBukkit start - teleport event
if (this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox)) { EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.world.getWorld(), d3, d4, d5), new Location(this.world.getWorld(), this.locX, this.locY, this.locZ));
flag = true; this.world.getServer().getPluginManager().callEvent(teleport);
if (!teleport.isCancelled()) {
Location to = teleport.getTo();
this.setPosition(to.getX(), to.getY(), to.getZ());
if (this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox)) {
flag = true;
}
} else {
return false;
} }
// CraftBukkit end
} }
} }