mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
67 lines
2.2 KiB
Diff
67 lines
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Cryptite <cryptite@gmail.com>
|
|
Date: Mon, 1 May 2023 15:23:34 -0500
|
|
Subject: [PATCH] Add PlayerGetRespawnLocationEvent
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerGetRespawnLocationEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerGetRespawnLocationEvent.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..98e369de90ac2b71363bb0a45bb5baaf14e1cd5a
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerGetRespawnLocationEvent.java
|
|
@@ -0,0 +1,55 @@
|
|
+package com.destroystokyo.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.bukkit.event.player.PlayerRespawnEvent;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+import org.jetbrains.annotations.Nullable;
|
|
+
|
|
+/**
|
|
+ * Called when a respawn event tries to determine the location of a respawn. This is called before {@link PlayerRespawnEvent}
|
|
+ */
|
|
+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;
|
|
+ }
|
|
+}
|