Add PlayerPreRespawnEvent
This commit is contained in:
66
patches/api/0019-Add-PlayerPreRespawnEvent.patch
Normal file
66
patches/api/0019-Add-PlayerPreRespawnEvent.patch
Normal file
@@ -0,0 +1,66 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 28 Dec 2024 07:59:54 -0600
|
||||
Subject: [PATCH] Add PlayerPreRespawnEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerPreRespawnEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerPreRespawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c98a1e76e565d4b95b5fe31f734f8ab496348ecb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerPreRespawnEvent.java
|
||||
@@ -0,0 +1,54 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.apache.commons.lang3.Validate;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called before a player's respawn location is determined.
|
||||
+ */
|
||||
+public class PlayerPreRespawnEvent extends PlayerEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private Location respawnLocation;
|
||||
+
|
||||
+ public PlayerPreRespawnEvent(@NotNull final Player respawnPlayer) {
|
||||
+ super(respawnPlayer);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the current respawn location
|
||||
+ *
|
||||
+ * @return Location current respawn location
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Location getRespawnLocation() {
|
||||
+ return this.respawnLocation;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the new respawn location
|
||||
+ *
|
||||
+ * @param respawnLocation new location for the respawn
|
||||
+ */
|
||||
+ public void setRespawnLocation(@NotNull Location respawnLocation) {
|
||||
+ Validate.notNull(respawnLocation, "Respawn location can not be null");
|
||||
+ Validate.notNull(respawnLocation.getWorld(), "Respawn world can not be null");
|
||||
+
|
||||
+ this.respawnLocation = respawnLocation;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
Reference in New Issue
Block a user