2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Trigary <trigary0@gmail.com>
|
|
|
|
Date: Mon, 25 Jan 2021 14:53:49 +0100
|
|
|
|
Subject: [PATCH] add DragonEggFormEvent
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/event/block/DragonEggFormEvent.java b/src/main/java/io/papermc/paper/event/block/DragonEggFormEvent.java
|
|
|
|
new file mode 100644
|
2024-02-01 10:15:57 +01:00
|
|
|
index 0000000000000000000000000000000000000000..695c21a296c6d12e1204eba33b92c44e7c2d98b8
|
2021-06-11 14:02:28 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/io/papermc/paper/event/block/DragonEggFormEvent.java
|
2024-02-01 10:15:57 +01:00
|
|
|
@@ -0,0 +1,55 @@
|
2021-06-11 14:02:28 +02:00
|
|
|
+package io.papermc.paper.event.block;
|
|
|
|
+
|
|
|
|
+import org.bukkit.Material;
|
|
|
|
+import org.bukkit.block.Block;
|
|
|
|
+import org.bukkit.block.BlockState;
|
|
|
|
+import org.bukkit.boss.DragonBattle;
|
|
|
|
+import org.bukkit.entity.EnderDragon;
|
|
|
|
+import org.bukkit.event.HandlerList;
|
|
|
|
+import org.bukkit.event.block.BlockFormEvent;
|
2024-02-01 10:15:57 +01:00
|
|
|
+import org.jetbrains.annotations.ApiStatus;
|
2021-06-11 14:02:28 +02:00
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Called when the {@link EnderDragon} is defeated (killed) in a {@link DragonBattle},
|
|
|
|
+ * causing a {@link Material#DRAGON_EGG} (more formally: {@link #getNewState()})
|
|
|
|
+ * to possibly appear depending on {@link #isCancelled()}.
|
2024-02-01 10:15:57 +01:00
|
|
|
+ * <p>
|
2021-06-11 14:02:28 +02:00
|
|
|
+ * <b>This event might be cancelled by default depending on
|
2024-02-01 10:15:57 +01:00
|
|
|
+ * e.g. {@link DragonBattle#hasBeenPreviouslyKilled()} and server configuration.</b>
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
2024-02-01 10:15:57 +01:00
|
|
|
+public class DragonEggFormEvent extends BlockFormEvent {
|
|
|
|
+
|
|
|
|
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
|
|
|
+
|
|
|
|
+ private final DragonBattle dragonBattle;
|
|
|
|
+
|
|
|
|
+ @ApiStatus.Internal
|
|
|
|
+ public DragonEggFormEvent(@NotNull Block block, @NotNull BlockState newState, @NotNull DragonBattle dragonBattle) {
|
|
|
|
+ super(block, newState);
|
|
|
|
+ this.dragonBattle = dragonBattle;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Gets the {@link DragonBattle} associated with this event.
|
|
|
|
+ * Keep in mind that the {@link EnderDragon} is already dead
|
|
|
|
+ * when this event is called.
|
|
|
|
+ *
|
|
|
|
+ * @return the dragon battle
|
|
|
|
+ */
|
|
|
|
+ @NotNull
|
|
|
|
+ public DragonBattle getDragonBattle() {
|
|
|
|
+ return this.dragonBattle;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @NotNull
|
|
|
|
+ @Override
|
|
|
|
+ public HandlerList getHandlers() {
|
|
|
|
+ return HANDLER_LIST;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @NotNull
|
|
|
|
+ public static HandlerList getHandlerList() {
|
|
|
|
+ return HANDLER_LIST;
|
|
|
|
+ }
|
2021-06-11 14:02:28 +02:00
|
|
|
+}
|