mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-26 14:30:17 +01:00
24 lines
2.1 KiB
Diff
24 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 51e00fe2454af281ba28dd6d5d5a1151103c0ab4..bdf79f73ab219debd4eedff44018dd8ab705b4e8 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -1446,6 +1446,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) {
|