Scissors/patches/api/0001-Add-MasterBlockFireEvent.patch
2022-07-04 22:34:11 +01:00

64 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Allink <arclicious@vivaldi.net>
Date: Mon, 4 Jul 2022 16:44:35 +0100
Subject: [PATCH] Add MasterBlockFireEvent
diff --git a/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java b/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..a24cb52a5af62012c5d5acc29e4c3558e92ae572
--- /dev/null
+++ b/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java
@@ -0,0 +1,51 @@
+package me.totalfreedom.scissors.event.block;
+
+import org.bukkit.Location;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a GameMasterBlock is fired (i.e. command block, structure block, jigsaw block)
+ */
+public class MasterBlockFireEvent extends Event implements Cancellable
+{
+
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancelled;
+ private final Location at;
+
+ public MasterBlockFireEvent(@NotNull Location at)
+ {
+ this.at = at;
+ }
+
+ public static @NotNull HandlerList getHandlerList()
+ {
+ return handlers;
+ }
+
+ public @NotNull Location getAt()
+ {
+ return this.at;
+ }
+
+ @Override
+ public @NotNull HandlerList getHandlers()
+ {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled()
+ {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancelled)
+ {
+ this.cancelled = cancelled;
+ }
+}