blob: 750c0f2a41a2022d83e8d09eea17e8273d80b95f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
--- a/net/minecraft/server/TileEntityEndGateway.java
+++ b/net/minecraft/server/TileEntityEndGateway.java
@@ -5,14 +5,18 @@
import java.util.Random;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.bukkit.event.player.PlayerTeleportEvent;
public class TileEntityEndGateway extends TileEntity implements ITickable {
private static final Logger a = LogManager.getLogger();
private long f = 0L;
private int g = 0;
- private BlockPosition h;
- private boolean i;
+ public BlockPosition h; // PAIL private to public
+ public boolean i; // PAIL private to public
public TileEntityEndGateway() {}
@@ -103,6 +107,26 @@
if (this.h != null) {
BlockPosition blockposition = this.i ? this.h : this.j();
+ // 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());
+ this.h();
+ return;
+
+ }
+ // CraftBukkit end
+
entity.enderTeleportTo((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D);
}
|