aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0722-Add-EntityPortalReadyEvent.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0722-Add-EntityPortalReadyEvent.patch')
-rw-r--r--patches/server/0722-Add-EntityPortalReadyEvent.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/patches/server/0722-Add-EntityPortalReadyEvent.patch b/patches/server/0722-Add-EntityPortalReadyEvent.patch
new file mode 100644
index 0000000000..56705093a3
--- /dev/null
+++ b/patches/server/0722-Add-EntityPortalReadyEvent.patch
@@ -0,0 +1,25 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jake Potrebic <[email protected]>
+Date: Wed, 12 May 2021 04:30:42 -0700
+Subject: [PATCH] Add EntityPortalReadyEvent
+
+
+diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
+index e2969b49494c55c3705312361ee8083b05ef569e..417a9ab28d247d5fbb3f1097fdeccab7ad2a793b 100644
+--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
++++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
+@@ -133,6 +133,14 @@ public class NetherPortalBlock extends Block implements Portal {
+ // CraftBukkit start
+ ResourceKey<Level> resourcekey = world.getTypeKey() == LevelStem.NETHER ? Level.OVERWORLD : Level.NETHER;
+ ServerLevel worldserver1 = world.getServer().getLevel(resourcekey);
++ // Paper start - Add EntityPortalReadyEvent
++ io.papermc.paper.event.entity.EntityPortalReadyEvent portalReadyEvent = new io.papermc.paper.event.entity.EntityPortalReadyEvent(entity.getBukkitEntity(), worldserver1 == null ? null : worldserver1.getWorld(), org.bukkit.PortalType.NETHER);
++ if (!portalReadyEvent.callEvent()) {
++ entity.portalProcess = null;
++ return null;
++ }
++ worldserver1 = portalReadyEvent.getTargetWorld() == null ? null : ((org.bukkit.craftbukkit.CraftWorld) portalReadyEvent.getTargetWorld()).getHandle();
++ // Paper end - Add EntityPortalReadyEvent
+
+ if (worldserver1 == null) {
+ return new DimensionTransition(PlayerTeleportEvent.TeleportCause.NETHER_PORTAL); // always fire event in case plugins wish to change it