2016-03-03 00:41:59 +08:00
|
|
|
--- a/net/minecraft/server/TileEntityEndGateway.java
|
|
|
|
+++ b/net/minecraft/server/TileEntityEndGateway.java
|
2018-12-06 07:00:00 +08:00
|
|
|
@@ -6,6 +6,12 @@
|
2016-05-10 19:47:39 +08:00
|
|
|
import javax.annotation.Nullable;
|
2016-03-03 00:41:59 +08:00
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
import org.apache.logging.log4j.Logger;
|
2016-05-10 19:47:39 +08:00
|
|
|
+// CraftBukkit start
|
2016-03-03 00:41:59 +08:00
|
|
|
+import org.bukkit.Bukkit;
|
|
|
|
+import org.bukkit.Location;
|
|
|
|
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
|
|
|
+import org.bukkit.event.player.PlayerTeleportEvent;
|
2016-05-10 19:47:39 +08:00
|
|
|
+// CraftBukkit end
|
2016-03-03 00:41:59 +08:00
|
|
|
|
2016-11-17 09:41:03 +08:00
|
|
|
public class TileEntityEndGateway extends TileEntityEnderPortal implements ITickable {
|
2016-03-03 00:41:59 +08:00
|
|
|
|
2018-07-15 08:00:00 +08:00
|
|
|
@@ -113,6 +119,26 @@
|
2016-05-10 19:47:39 +08:00
|
|
|
if (this.exitPortal != null) {
|
2018-07-15 08:00:00 +08:00
|
|
|
BlockPosition blockposition = this.exactTeleport ? this.exitPortal : this.i();
|
2016-03-03 00:41:59 +08:00
|
|
|
|
|
|
|
+ // CraftBukkit start - Fire PlayerTeleportEvent
|
|
|
|
+ if (entity instanceof EntityPlayer) {
|
|
|
|
+ org.bukkit.craftbukkit.entity.CraftPlayer player = (CraftPlayer) entity.getBukkitEntity();
|
|
|
|
+ org.bukkit.Location location = new Location(world.getWorld(), (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D);
|
|
|
|
+ location.setPitch(player.getLocation().getPitch());
|
|
|
|
+ location.setYaw(player.getLocation().getYaw());
|
|
|
|
+
|
|
|
|
+ PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.END_GATEWAY);
|
|
|
|
+ Bukkit.getPluginManager().callEvent(teleEvent);
|
|
|
|
+ if (teleEvent.isCancelled()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ((EntityPlayer) entity).playerConnection.teleport(teleEvent.getTo());
|
2018-07-15 08:00:00 +08:00
|
|
|
+ this.f(); // CraftBukkit - call at end of method
|
2016-03-03 00:41:59 +08:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
+
|
|
|
|
entity.enderTeleportTo((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D);
|
|
|
|
}
|
|
|
|
|