mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 00:10:32 +01:00
Include RespawnReason
This commit is contained in:
parent
6c4fc6ca3b
commit
2f20697d27
@ -6,10 +6,10 @@ Subject: [PATCH] Add PlayerPreRespawnLocationEvent
|
|||||||
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerPreRespawnLocationEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerPreRespawnLocationEvent.java
|
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerPreRespawnLocationEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerPreRespawnLocationEvent.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..7cbe6d1b4d4420e7cccdb0bd54f671569f604c08
|
index 0000000000000000000000000000000000000000..cf81752c60fb1cd5a649c50acea759036ba9d094
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerPreRespawnLocationEvent.java
|
+++ b/src/main/java/io/papermc/paper/event/player/PlayerPreRespawnLocationEvent.java
|
||||||
@@ -0,0 +1,57 @@
|
@@ -0,0 +1,68 @@
|
||||||
+package io.papermc.paper.event.player;
|
+package io.papermc.paper.event.player;
|
||||||
+
|
+
|
||||||
+import org.apache.commons.lang3.Validate;
|
+import org.apache.commons.lang3.Validate;
|
||||||
@ -26,10 +26,12 @@ index 0000000000000000000000000000000000000000..7cbe6d1b4d4420e7cccdb0bd54f67156
|
|||||||
+ */
|
+ */
|
||||||
+public class PlayerPreRespawnLocationEvent extends PlayerEvent {
|
+public class PlayerPreRespawnLocationEvent extends PlayerEvent {
|
||||||
+ private static final HandlerList handlers = new HandlerList();
|
+ private static final HandlerList handlers = new HandlerList();
|
||||||
|
+ private final PlayerRespawnEvent.RespawnReason respawnReason;
|
||||||
+ private Location respawnLocation;
|
+ private Location respawnLocation;
|
||||||
+
|
+
|
||||||
+ public PlayerPreRespawnLocationEvent(@NotNull final Player respawnPlayer) {
|
+ public PlayerPreRespawnLocationEvent(@NotNull final Player respawnPlayer, PlayerRespawnEvent.RespawnReason respawnReason) {
|
||||||
+ super(respawnPlayer);
|
+ super(respawnPlayer);
|
||||||
|
+ this.respawnReason = respawnReason;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
@ -56,6 +58,15 @@ index 0000000000000000000000000000000000000000..7cbe6d1b4d4420e7cccdb0bd54f67156
|
|||||||
+ this.respawnLocation = respawnLocation;
|
+ this.respawnLocation = respawnLocation;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Gets the reason this respawn event was called.
|
||||||
|
+ *
|
||||||
|
+ * @return the reason the event was called.
|
||||||
|
+ */
|
||||||
|
+ public PlayerRespawnEvent.RespawnReason getRespawnReason() {
|
||||||
|
+ return respawnReason;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ @NotNull
|
+ @NotNull
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public HandlerList getHandlers() {
|
+ public HandlerList getHandlers() {
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerPreRespawnLocationEvent
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
index 4d837c1530a3031a4c2a5a39d87bd013d60e14a6..c515eb85becbea8e9cad33e1f14f5f0fc3d1f513 100644
|
index 4d837c1530a3031a4c2a5a39d87bd013d60e14a6..203d43c0902132bed1e396bc956d2313447d3534 100644
|
||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
@@ -835,6 +835,14 @@ public abstract class PlayerList {
|
@@ -835,6 +835,14 @@ public abstract class PlayerList {
|
||||||
@ -14,7 +14,7 @@ index 4d837c1530a3031a4c2a5a39d87bd013d60e14a6..c515eb85becbea8e9cad33e1f14f5f0f
|
|||||||
if (location == null) {
|
if (location == null) {
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ Player respawnPlayer = entityplayer1.getBukkitEntity();
|
+ Player respawnPlayer = entityplayer1.getBukkitEntity();
|
||||||
+ io.papermc.paper.event.player.PlayerPreRespawnLocationEvent preRespawnEvent = new io.papermc.paper.event.player.PlayerPreRespawnLocationEvent(respawnPlayer);
|
+ io.papermc.paper.event.player.PlayerPreRespawnLocationEvent preRespawnEvent = new io.papermc.paper.event.player.PlayerPreRespawnLocationEvent(respawnPlayer, reason);
|
||||||
+ preRespawnEvent.callEvent();
|
+ preRespawnEvent.callEvent();
|
||||||
+ location = preRespawnEvent.getRespawnLocation();
|
+ location = preRespawnEvent.getRespawnLocation();
|
||||||
+
|
+
|
||||||
|
Loading…
Reference in New Issue
Block a user