mirror of
https://github.com/PaperMC/Paper.git
synced 2025-05-19 05:30:23 -07:00
Deprecate TeleportCause CHORUS_FRUIT for CONSUMABLE_EFFECT (#12546)
This commit is contained in:
parent
f1dbed072c
commit
cc38032bee
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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<Boolean> status = entity.randomTeleport(d, d1, d2, true, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT);
|
||||
+ java.util.Optional<Boolean> 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user