diff options
author | md_5 <git@md-5.net> | 2016-06-12 12:51:53 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2016-06-12 12:51:53 +1000 |
commit | ac58f3840ebe6060511c56ca8c4440916ea46425 (patch) | |
tree | 5e1be666fc95c33ebf80356554ae2667712b7727 /nms-patches | |
parent | 1f507256e79798f9e8e6a9114de4830bbdfa9bf3 (diff) | |
download | craftbukkit-ac58f3840ebe6060511c56ca8c4440916ea46425.tar craftbukkit-ac58f3840ebe6060511c56ca8c4440916ea46425.tar.gz craftbukkit-ac58f3840ebe6060511c56ca8c4440916ea46425.tar.lz craftbukkit-ac58f3840ebe6060511c56ca8c4440916ea46425.tar.xz craftbukkit-ac58f3840ebe6060511c56ca8c4440916ea46425.zip |
SPIGOT-2348: EntityTeleportEvent cancellation
Diffstat (limited to 'nms-patches')
-rw-r--r-- | nms-patches/EntityLiving.patch | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/nms-patches/EntityLiving.patch b/nms-patches/EntityLiving.patch index e98c137c..be5dbc2e 100644 --- a/nms-patches/EntityLiving.patch +++ b/nms-patches/EntityLiving.patch @@ -580,22 +580,25 @@ if (itemstack != null && itemstack.count == 0) { itemstack = null; -@@ -2051,7 +2332,17 @@ +@@ -2051,10 +2332,18 @@ } if (flag1) { - this.enderTeleportTo(this.locX, this.locY, this.locZ); +- if (world.getCubes(this, this.getBoundingBox()).isEmpty() && !world.containsLiquid(this.getBoundingBox())) { +- flag = true; + // CraftBukkit start - Teleport event + // this.enderTeleportTo(this.locX, this.locY, this.locZ); + 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)); + this.world.getServer().getPluginManager().callEvent(teleport); -+ if (teleport.isCancelled()) { -+ return false; -+ } -+ -+ Location to = teleport.getTo(); -+ this.enderTeleportTo(to.getX(), to.getY(), to.getZ()); -+ // CraftBukkit end - if (world.getCubes(this, this.getBoundingBox()).isEmpty() && !world.containsLiquid(this.getBoundingBox())) { - flag = true; ++ if (!teleport.isCancelled()) { ++ Location to = teleport.getTo(); ++ this.enderTeleportTo(to.getX(), to.getY(), to.getZ()); ++ if (world.getCubes(this, this.getBoundingBox()).isEmpty() && !world.containsLiquid(this.getBoundingBox())) { ++ flag = true; ++ } } ++ // CraftBukkit end + } + } + |