mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-12 04:06:52 +01:00
25 lines
2.1 KiB
Diff
25 lines
2.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sat, 31 Dec 2016 21:44:50 -0500
|
|
Subject: [PATCH] PlayerTeleportEndGatewayEvent
|
|
|
|
Allows you to access the Gateway being used in a teleport event
|
|
Fix the offset used for player teleportation
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
index 5890aa22912eed9d645393f5a7189d6884fb2c66..b99bd43bf5185bed21fad7dac31baf1a30bdd1fe 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -1455,6 +1455,11 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
|
PositionMoveRotation absolutePosition = PositionMoveRotation.calculateAbsolute(PositionMoveRotation.of(this), PositionMoveRotation.of(teleportTarget), teleportTarget.relatives());
|
|
Location exit = (worldserver == null) ? null : CraftLocation.toBukkit(absolutePosition.position(), worldserver.getWorld(), absolutePosition.yRot(), absolutePosition.xRot());
|
|
PlayerTeleportEvent tpEvent = new PlayerTeleportEvent(this.getBukkitEntity(), enter, exit, teleportTarget.cause());
|
|
+ // Paper start - gateway-specific teleport event
|
|
+ if (this.portalProcess != null && this.portalProcess.isSamePortal(((net.minecraft.world.level.block.EndGatewayBlock) net.minecraft.world.level.block.Blocks.END_GATEWAY)) && this.serverLevel().getBlockEntity(this.portalProcess.getEntryPosition()) instanceof net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity theEndGatewayBlockEntity) {
|
|
+ tpEvent = new com.destroystokyo.paper.event.player.PlayerTeleportEndGatewayEvent(this.getBukkitEntity(), enter, exit, new org.bukkit.craftbukkit.block.CraftEndGateway(this.serverLevel().getWorld(), theEndGatewayBlockEntity));
|
|
+ }
|
|
+ // Paper end - gateway-specific teleport event
|
|
Bukkit.getServer().getPluginManager().callEvent(tpEvent);
|
|
Location newExit = tpEvent.getTo();
|
|
if (tpEvent.isCancelled() || newExit == null) {
|