Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 02:50:09 +01:00
c97ce029e9
PaperMC believes that 1.16.2 is now ready for general release as we fixed the main issue plagueing the 1.16.x release, the MapLike data conversion issues. Until now, it was not safe for a server to convert a world to 1.16.2 without data conversion issues around villages and potentially other things. If you did, those MapLike errors meant something went wrong. This is now resolved. Big thanks to all those that helped, notably @BillyGalbreath and @Proximyst who did large parts of the update process with me. Please as always, backup your worlds and test before updating to 1.16.2! If you update to 1.16.2, there is no going back to an older build than this. --------------------------------- Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com> Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com> Co-authored-by: krolik-exe <69214078+krolik-exe@users.noreply.github.com> Co-authored-by: BillyGalbreath <BillyGalbreath@users.noreply.github.com> Co-authored-by: stonar96 <minecraft.stonar96@gmail.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Jason <jasonpenilla2@me.com> Co-authored-by: kashike <kashike@vq.lc> Co-authored-by: Aurora <21148213+aurorasmiles@users.noreply.github.com> Co-authored-by: KennyTV <kennytv@t-online.de> Co-authored-by: commandblockguy <commandblockguy1@gmail.com> Co-authored-by: DigitalRegent <misterwener@gmail.com> Co-authored-by: ishland <ishlandmc@yeah.net>
142 Zeilen
4.5 KiB
Diff
142 Zeilen
4.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Caleb Bassham <caleb.bassham@gmail.com>
|
|
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..b8ec7ef2d4ef0683cc0d6ca86885dd9a01f47e16
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java
|
|
@@ -0,0 +1,67 @@
|
|
+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.NotNull;
|
|
+
|
|
+/**
|
|
+ * Triggered when a player starts spectating an entity in spectator mode.
|
|
+ */
|
|
+public class PlayerStartSpectatingEntityEvent extends PlayerEvent implements Cancellable {
|
|
+
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+ private boolean cancelled;
|
|
+ @NotNull private final Entity currentSpectatorTarget;
|
|
+ @NotNull private final Entity newSpectatorTarget;
|
|
+
|
|
+ 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 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 newSpectatorTarget;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isCancelled() {
|
|
+ return cancelled;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCancelled(boolean cancel) {
|
|
+ this.cancelled = cancel;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ @Override
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+}
|
|
+
|
|
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..693d119ab920a1bd0d1b5a0feb092631715ec0ad
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java
|
|
@@ -0,0 +1,54 @@
|
|
+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.NotNull;
|
|
+
|
|
+/**
|
|
+ * Triggered when a player stops spectating an entity in spectator mode.
|
|
+ */
|
|
+public class PlayerStopSpectatingEntityEvent extends PlayerEvent implements Cancellable {
|
|
+
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+ private boolean cancelled;
|
|
+ @NotNull private final Entity spectatorTarget;
|
|
+
|
|
+ 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 spectatorTarget;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isCancelled() {
|
|
+ return cancelled;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCancelled(boolean cancel) {
|
|
+ this.cancelled = cancel;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ @Override
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+}
|