Comply with Bukkit's dumbass annotations requirement

This commit is contained in:
William Blake Galbreath
2019-06-06 23:42:49 -05:00
parent d6a74e9c23
commit d92210e9b6

View File

@@ -1,28 +1,29 @@
From f1b7acbe7eaaa5f94fbe5fbf2bf8b907885dfecf Mon Sep 17 00:00:00 2001 From 8272f3bf685efcdfa39f21e05ccfeac8560144d2 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com> From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 6 Jun 2019 23:23:45 -0500 Date: Thu, 6 Jun 2019 23:23:45 -0500
Subject: [PATCH] Block and Fluid Tick Events Subject: [PATCH] Block and Fluid Tick Events
--- ---
.../purpur/event/block/BlockTickEvent.java | 49 +++++++++++++++++++ .../purpur/event/block/BlockTickEvent.java | 52 +++++++++++++++++++
.../purpur/event/block/FluidTickEvent.java | 49 +++++++++++++++++++ .../purpur/event/block/FluidTickEvent.java | 52 +++++++++++++++++++
src/main/java/org/bukkit/World.java | 30 ++++++++++++ src/main/java/org/bukkit/World.java | 30 +++++++++++
3 files changed, 128 insertions(+) 3 files changed, 134 insertions(+)
create mode 100644 src/main/java/net/pl3x/purpur/event/block/BlockTickEvent.java create mode 100644 src/main/java/net/pl3x/purpur/event/block/BlockTickEvent.java
create mode 100644 src/main/java/net/pl3x/purpur/event/block/FluidTickEvent.java create mode 100644 src/main/java/net/pl3x/purpur/event/block/FluidTickEvent.java
diff --git a/src/main/java/net/pl3x/purpur/event/block/BlockTickEvent.java b/src/main/java/net/pl3x/purpur/event/block/BlockTickEvent.java diff --git a/src/main/java/net/pl3x/purpur/event/block/BlockTickEvent.java b/src/main/java/net/pl3x/purpur/event/block/BlockTickEvent.java
new file mode 100644 new file mode 100644
index 00000000..5325e0c0 index 00000000..e467052a
--- /dev/null --- /dev/null
+++ b/src/main/java/net/pl3x/purpur/event/block/BlockTickEvent.java +++ b/src/main/java/net/pl3x/purpur/event/block/BlockTickEvent.java
@@ -0,0 +1,49 @@ @@ -0,0 +1,52 @@
+package net.pl3x.purpur.event.block; +package net.pl3x.purpur.event.block;
+ +
+import org.bukkit.World; +import org.bukkit.World;
+import org.bukkit.event.Cancellable; +import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList; +import org.bukkit.event.HandlerList;
+import org.bukkit.event.block.BlockEvent; +import org.bukkit.event.block.BlockEvent;
+import org.jetbrains.annotations.NotNull;
+ +
+/** +/**
+ * Called when a block is ticked by the server. + * Called when a block is ticked by the server.
@@ -32,11 +33,11 @@ index 00000000..5325e0c0
+ private final boolean isRandomTick; + private final boolean isRandomTick;
+ private boolean cancelled; + private boolean cancelled;
+ +
+ public BlockTickEvent(World world, int x, int y, int z) { + public BlockTickEvent(@NotNull World world, int x, int y, int z) {
+ this(world, x, y, z, false); + this(world, x, y, z, false);
+ } + }
+ +
+ public BlockTickEvent(World world, int x, int y, int z, boolean isRandomTick) { + public BlockTickEvent(@NotNull World world, int x, int y, int z, boolean isRandomTick) {
+ super(world.getBlockAt(x, y, z)); + super(world.getBlockAt(x, y, z));
+ this.isRandomTick = isRandomTick; + this.isRandomTick = isRandomTick;
+ } + }
@@ -58,26 +59,29 @@ index 00000000..5325e0c0
+ cancelled = cancel; + cancelled = cancel;
+ } + }
+ +
+ @NotNull
+ public HandlerList getHandlers() { + public HandlerList getHandlers() {
+ return handlers; + return handlers;
+ } + }
+ +
+ @NotNull
+ public static HandlerList getHandlerList() { + public static HandlerList getHandlerList() {
+ return handlers; + return handlers;
+ } + }
+} +}
diff --git a/src/main/java/net/pl3x/purpur/event/block/FluidTickEvent.java b/src/main/java/net/pl3x/purpur/event/block/FluidTickEvent.java diff --git a/src/main/java/net/pl3x/purpur/event/block/FluidTickEvent.java b/src/main/java/net/pl3x/purpur/event/block/FluidTickEvent.java
new file mode 100644 new file mode 100644
index 00000000..77d18fb8 index 00000000..9cd1e3dd
--- /dev/null --- /dev/null
+++ b/src/main/java/net/pl3x/purpur/event/block/FluidTickEvent.java +++ b/src/main/java/net/pl3x/purpur/event/block/FluidTickEvent.java
@@ -0,0 +1,49 @@ @@ -0,0 +1,52 @@
+package net.pl3x.purpur.event.block; +package net.pl3x.purpur.event.block;
+ +
+import org.bukkit.World; +import org.bukkit.World;
+import org.bukkit.event.Cancellable; +import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList; +import org.bukkit.event.HandlerList;
+import org.bukkit.event.block.BlockEvent; +import org.bukkit.event.block.BlockEvent;
+import org.jetbrains.annotations.NotNull;
+ +
+/** +/**
+ * Called when a fluid is ticked by the server. + * Called when a fluid is ticked by the server.
@@ -87,11 +91,11 @@ index 00000000..77d18fb8
+ private final boolean isRandomTick; + private final boolean isRandomTick;
+ private boolean cancelled; + private boolean cancelled;
+ +
+ public FluidTickEvent(World world, int x, int y, int z) { + public FluidTickEvent(@NotNull World world, int x, int y, int z) {
+ this(world, x, y, z, false); + this(world, x, y, z, false);
+ } + }
+ +
+ public FluidTickEvent(World world, int x, int y, int z, boolean isRandomTick) { + public FluidTickEvent(@NotNull World world, int x, int y, int z, boolean isRandomTick) {
+ super(world.getBlockAt(x, y, z)); + super(world.getBlockAt(x, y, z));
+ this.isRandomTick = isRandomTick; + this.isRandomTick = isRandomTick;
+ } + }
@@ -113,10 +117,12 @@ index 00000000..77d18fb8
+ cancelled = cancel; + cancelled = cancel;
+ } + }
+ +
+ @NotNull
+ public HandlerList getHandlers() { + public HandlerList getHandlers() {
+ return handlers; + return handlers;
+ } + }
+ +
+ @NotNull
+ public static HandlerList getHandlerList() { + public static HandlerList getHandlerList() {
+ return handlers; + return handlers;
+ } + }