[ci skip] Cleanup events (#10202)

This commit is contained in:
Lulu13022002
2024-02-01 10:15:57 +01:00
parent d676979ea0
commit f7e469eb2e
187 changed files with 2415 additions and 2258 deletions

View File

@@ -16,6 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.block.Block;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.block.BlockEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
@@ -23,8 +24,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Activation occurs when the beacon beam becomes visible.
+ */
+public class BeaconActivatedEvent extends BlockEvent {
+ private static final HandlerList handlers = new HandlerList();
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @ApiStatus.Internal
+ public BeaconActivatedEvent(@NotNull Block block) {
+ super(block);
+ }
@@ -36,18 +39,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ @NotNull
+ public Beacon getBeacon() {
+ return (Beacon) block.getState();
+ return (Beacon) this.block.getState();
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+}
diff --git a/src/main/java/io/papermc/paper/event/block/BeaconDeactivatedEvent.java b/src/main/java/io/papermc/paper/event/block/BeaconDeactivatedEvent.java
@@ -63,6 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.block.Block;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.block.BlockEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
@@ -70,32 +74,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Called when a beacon is deactivated, either because its base block(s) or itself were destroyed.
+ */
+public class BeaconDeactivatedEvent extends BlockEvent {
+ private static final HandlerList handlers = new HandlerList();
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @ApiStatus.Internal
+ public BeaconDeactivatedEvent(@NotNull Block block) {
+ super(block);
+ }
+
+ /**
+ * Returns the beacon that was deactivated.
+ * This will return null if the beacon does not exist.
+ * This will return {@code null} if the beacon does not exist.
+ * (which can occur after the deactivation of a now broken beacon)
+ *
+ * @return The beacon that got deactivated, or null if it does not exist.
+ * @return The beacon that got deactivated, or {@code null} if it does not exist.
+ */
+ @Nullable
+ public Beacon getBeacon() {
+ return block.getType() == Material.BEACON ? (Beacon) block.getState() : null;
+ return this.block.getType() == Material.BEACON ? (Beacon) this.block.getState() : null;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+}