Files
OldSliceMC/patches/api/0009-Add-PlayerGetRespawnLocationEvent.patch
2022-04-04 09:17:42 -05:00

66 lines
2.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Sun, 3 Apr 2022 08:28:24 -0500
Subject: [PATCH] Add PlayerGetRespawnLocationEvent
diff --git a/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java b/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..dd7ecdb59e1a7e89ea63767a688337bb22f9cf59
--- /dev/null
+++ b/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java
@@ -0,0 +1,53 @@
+package org.bukkit.event.player;
+
+import org.apache.commons.lang.Validate;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Called when a respawn event tries to determine the location of a respawn
+ */
+public class PlayerGetRespawnLocationEvent extends PlayerEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private Location respawnLocation;
+
+ public PlayerGetRespawnLocationEvent(@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;
+ }
+}