From 5913a2cc1aa9db500800f5e34baec48076c1441c Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sat, 9 Jun 2018 14:21:40 +0100 Subject: [PATCH] Add EntityTeleportEndGatewayEvent for entities (closes #1124) --- ...upstream-javadoc-warnings-and-errors.patch | 4 +- .../0053-Item-canEntityPickup.patch | 4 +- ...11-Add-EntityTeleportEndGatewayEvent.patch | 44 +++++++++++++++++++ ...lement-EntityTeleportEndGatewayEvent.patch | 34 ++++++++++++++ 4 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 Spigot-API-Patches/0111-Add-EntityTeleportEndGatewayEvent.patch create mode 100644 Spigot-Server-Patches/0303-Implement-EntityTeleportEndGatewayEvent.patch diff --git a/Spigot-API-Patches/0052-Fix-upstream-javadoc-warnings-and-errors.patch b/Spigot-API-Patches/0052-Fix-upstream-javadoc-warnings-and-errors.patch index 7163f921c5..0f98f62861 100644 --- a/Spigot-API-Patches/0052-Fix-upstream-javadoc-warnings-and-errors.patch +++ b/Spigot-API-Patches/0052-Fix-upstream-javadoc-warnings-and-errors.patch @@ -1,4 +1,4 @@ -From 712103d9db1ebca6fc45f8fdd8b8b123735cb630 Mon Sep 17 00:00:00 2001 +From 16c613ce58c5d072bff472f8e249ffa206ea814d Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sat, 10 Jun 2017 16:59:40 -0500 Subject: [PATCH] Fix upstream javadoc warnings and errors @@ -348,5 +348,5 @@ index 92174e81..ac5cc32c 100644 ChatColor getColor() throws IllegalStateException; -- -2.16.1 +2.17.1 diff --git a/Spigot-API-Patches/0053-Item-canEntityPickup.patch b/Spigot-API-Patches/0053-Item-canEntityPickup.patch index 2e2b278c0e..1104b95c0e 100644 --- a/Spigot-API-Patches/0053-Item-canEntityPickup.patch +++ b/Spigot-API-Patches/0053-Item-canEntityPickup.patch @@ -1,4 +1,4 @@ -From 8e5a65fb5168e3a6f655fb0e99b3ca98b7e73860 Mon Sep 17 00:00:00 2001 +From be61a682cc9453b4372ac821c4aea25ba90ba606 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Fri, 5 May 2017 03:57:08 -0500 Subject: [PATCH] Item#canEntityPickup @@ -30,5 +30,5 @@ index 90260b7e..2e98e4f9 100644 + // Paper end } -- -2.13.1 +2.17.1 diff --git a/Spigot-API-Patches/0111-Add-EntityTeleportEndGatewayEvent.patch b/Spigot-API-Patches/0111-Add-EntityTeleportEndGatewayEvent.patch new file mode 100644 index 0000000000..dd5eb6d02d --- /dev/null +++ b/Spigot-API-Patches/0111-Add-EntityTeleportEndGatewayEvent.patch @@ -0,0 +1,44 @@ +From e3bebcf4cbf12c0cd7c2c3627dfd87b53837a408 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Sat, 9 Jun 2018 13:08:21 +0100 +Subject: [PATCH] Add EntityTeleportEndGatewayEvent + + +diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java +new file mode 100644 +index 00000000..80899ecb +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java +@@ -0,0 +1,29 @@ ++package com.destroystokyo.paper.event.entity; ++ ++import org.bukkit.Location; ++import org.bukkit.block.EndGateway; ++import org.bukkit.entity.Entity; ++import org.bukkit.event.entity.EntityTeleportEvent; ++ ++/** ++ * Fired any time an entity attempts to teleport in an end gateway ++ */ ++public class EntityTeleportEndGatewayEvent extends EntityTeleportEvent { ++ ++ private final EndGateway gateway; ++ ++ public EntityTeleportEndGatewayEvent(Entity what, Location from, Location to, EndGateway gateway) { ++ super(what, from, to); ++ this.gateway = gateway; ++ } ++ ++ /** ++ * The gateway triggering the teleport ++ * ++ * @return EndGateway used ++ */ ++ public EndGateway getGateway() { ++ return gateway; ++ } ++ ++} +-- +2.17.1 + diff --git a/Spigot-Server-Patches/0303-Implement-EntityTeleportEndGatewayEvent.patch b/Spigot-Server-Patches/0303-Implement-EntityTeleportEndGatewayEvent.patch new file mode 100644 index 0000000000..fd5f277aca --- /dev/null +++ b/Spigot-Server-Patches/0303-Implement-EntityTeleportEndGatewayEvent.patch @@ -0,0 +1,34 @@ +From de0b586bc05412392f63b9bb4b6f2ce7f3e77c97 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Sat, 9 Jun 2018 13:08:39 +0100 +Subject: [PATCH] Implement EntityTeleportEndGatewayEvent + + +diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java +index ecbc48b0c..c84569612 100644 +--- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java ++++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java +@@ -136,8 +136,19 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick + + } + // CraftBukkit end ++ // Paper start - EntityTeleportEndGatewayEvent - replicated from above ++ org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity = 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(bukkitEntity.getLocation().getPitch()); ++ location.setYaw(bukkitEntity.getLocation().getYaw()); ++ ++ com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent event = new com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent(bukkitEntity, bukkitEntity.getLocation(), location, new org.bukkit.craftbukkit.block.CraftEndGateway(MCUtil.toLocation(world, this.getPosition()).getBlock())); ++ if (event.isCancelled()) { ++ return; ++ } + +- entity.enderTeleportTo((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D); ++ entity.enderTeleportTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()); ++ // Paper end - EntityTeleportEndGatewayEvent + } + + this.h(); +-- +2.17.1 +