diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java index 07e98ba821..236f09c712 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java @@ -1,5 +1,6 @@ package org.bukkit.event.player; +import io.papermc.paper.datacomponent.item.consumable.ConsumeEffect; import io.papermc.paper.entity.TeleportFlag; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -121,10 +122,9 @@ public class PlayerTeleportEvent extends PlayerMoveEvent { */ END_GATEWAY, /** - * Indicates the teleportation was caused by a player consuming chorus - * fruit + * Indicates the teleportation was caused by a player consuming an item with a {@link ConsumeEffect.TeleportRandomly} effect */ - CHORUS_FRUIT, + CONSUMABLE_EFFECT, /** * Indicates the teleportation was caused by a player exiting a vehicle */ @@ -137,6 +137,14 @@ public class PlayerTeleportEvent extends PlayerMoveEvent { * Indicates the teleportation was caused by an event not covered by * this enum */ - UNKNOWN + UNKNOWN; + + /** + * Indicates the teleportation was caused by a player consuming chorus + * fruit + * @deprecated in favor of {@link #CONSUMABLE_EFFECT} + */ + @Deprecated(since = "1.21.5", forRemoval = true) + public static final TeleportCause CHORUS_FRUIT = CONSUMABLE_EFFECT; } } diff --git a/paper-server/patches/sources/net/minecraft/world/item/consume_effects/TeleportRandomlyConsumeEffect.java.patch b/paper-server/patches/sources/net/minecraft/world/item/consume_effects/TeleportRandomlyConsumeEffect.java.patch index 36547c65ef..9731540c36 100644 --- a/paper-server/patches/sources/net/minecraft/world/item/consume_effects/TeleportRandomlyConsumeEffect.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/item/consume_effects/TeleportRandomlyConsumeEffect.java.patch @@ -6,7 +6,7 @@ Vec3 vec3 = entity.position(); - if (entity.randomTeleport(d, d1, d2, true)) { + // CraftBukkit start - handle canceled status of teleport event -+ java.util.Optional status = entity.randomTeleport(d, d1, d2, true, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT); ++ java.util.Optional status = entity.randomTeleport(d, d1, d2, true, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.CONSUMABLE_EFFECT); + + // teleport event was canceled, no more tries + if (status.isEmpty()) break;