diff options
author | Jake Potrebic <[email protected]> | 2024-06-14 14:07:44 -0700 |
---|---|---|
committer | Jake Potrebic <[email protected]> | 2024-06-14 14:07:44 -0700 |
commit | ffe310a8e1dd4ed1027e903b4683f0ab42ee9ff8 (patch) | |
tree | 7748595488691c8494b5bdb2d01711a5242f6b34 /patches/api/0152-Add-spectator-target-events.patch | |
parent | 188cff20c75367d8c90ae548a0dd528805d4a5a3 (diff) | |
download | Paper-ffe310a8e1dd4ed1027e903b4683f0ab42ee9ff8.tar.gz Paper-ffe310a8e1dd4ed1027e903b4683f0ab42ee9ff8.zip |
remove api that was scheduled for removal
Diffstat (limited to 'patches/api/0152-Add-spectator-target-events.patch')
-rw-r--r-- | patches/api/0152-Add-spectator-target-events.patch | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/patches/api/0152-Add-spectator-target-events.patch b/patches/api/0152-Add-spectator-target-events.patch new file mode 100644 index 0000000000..90f65b5fc8 --- /dev/null +++ b/patches/api/0152-Add-spectator-target-events.patch @@ -0,0 +1,148 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Caleb Bassham <[email protected]> +Date: Fri, 28 Sep 2018 02:30:56 -0500 +Subject: [PATCH] Add spectator target events + +- PlayerStartSpectatingEntityEvent +- PlayerStopSpectatingEntityEvent + +diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a70a64d2273414d95d77e601a41a208cce78e345 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java +@@ -0,0 +1,71 @@ ++package com.destroystokyo.paper.event.player; ++ ++import org.bukkit.entity.Entity; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Triggered when a player starts spectating an entity in spectator mode. ++ */ ++public class PlayerStartSpectatingEntityEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @NotNull private final Entity currentSpectatorTarget; ++ @NotNull private final Entity newSpectatorTarget; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerStartSpectatingEntityEvent(@NotNull Player player, @NotNull Entity currentSpectatorTarget, @NotNull Entity newSpectatorTarget) { ++ super(player); ++ this.currentSpectatorTarget = currentSpectatorTarget; ++ this.newSpectatorTarget = newSpectatorTarget; ++ } ++ ++ /** ++ * Gets the entity that the player is currently spectating or themselves if they weren't spectating anything ++ * ++ * @return The entity the player is currently spectating (before they start spectating the new target). ++ */ ++ @NotNull ++ public Entity getCurrentSpectatorTarget() { ++ return this.currentSpectatorTarget; ++ } ++ ++ /** ++ * Gets the new entity that the player will now be spectating ++ * ++ * @return The entity the player is now going to be spectating. ++ */ ++ @NotNull ++ public Entity getNewSpectatorTarget() { ++ return this.newSpectatorTarget; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} ++ +diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a6a5ebc534cc380740ba42790149c8b85f52aabb +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java +@@ -0,0 +1,57 @@ ++package com.destroystokyo.paper.event.player; ++ ++import org.bukkit.entity.Entity; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Triggered when a player stops spectating an entity in spectator mode. ++ */ ++public class PlayerStopSpectatingEntityEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @NotNull private final Entity spectatorTarget; ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerStopSpectatingEntityEvent(@NotNull Player player, @NotNull Entity spectatorTarget) { ++ super(player); ++ this.spectatorTarget = spectatorTarget; ++ } ++ ++ /** ++ * Gets the entity that the player is spectating ++ * ++ * @return The entity the player is currently spectating (before they will stop). ++ */ ++ @NotNull ++ public Entity getSpectatorTarget() { ++ return this.spectatorTarget; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} |