Scissors/patches/api/0002-Add-MasterBlockFireEvent.patch

64 lines
1.7 KiB
Diff
Raw Permalink Normal View History

2022-07-04 21:04:56 +00:00
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..812e6ae9f1c8eb9558e5109c522d3ce3a7deb35c
2022-07-04 21:04:56 +00:00
--- /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;
+ }
+}