3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 20:40:07 +01:00
Paper/nms-patches/BlockEnderPortal.patch

34 Zeilen
1.3 KiB
Diff

--- a/net/minecraft/server/BlockEnderPortal.java
+++ b/net/minecraft/server/BlockEnderPortal.java
@@ -1,5 +1,10 @@
package net.minecraft.server;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityPortalEnterEvent;
+import org.bukkit.event.player.PlayerTeleportEvent;
+// CraftBukkit end
+
public class BlockEnderPortal extends BlockTileEntity {
protected static final VoxelShape a = Block.a(0.0D, 0.0D, 0.0D, 16.0D, 12.0D, 16.0D);
@@ -25,9 +30,18 @@
WorldServer worldserver = ((WorldServer) world).getMinecraftServer().getWorldServer(resourcekey);
if (worldserver == null) {
- return;
+ // return; // CraftBukkit - always fire event in case plugins wish to change it
}
+ // CraftBukkit start - Entity in portal
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getServer().getPluginManager().callEvent(event);
+
+ if (entity instanceof EntityPlayer) {
+ ((EntityPlayer) entity).a(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
+ return;
+ }
+ // CraftBukkit end
entity.a(worldserver);
}