switch to JSpecify annotations

This commit is contained in:
granny
2024-10-03 19:33:40 -07:00
parent 212c942316
commit 2eaea6a060
13 changed files with 158 additions and 173 deletions

View File

@@ -18,35 +18,35 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
diff --git a/src/main/java/org/purpurmc/purpur/event/entity/EntityTeleportHinderedEvent.java b/src/main/java/org/purpurmc/purpur/event/entity/EntityTeleportHinderedEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..c66eb163877e872f234d86dc244cab7efeb818cd
index 0000000000000000000000000000000000000000..daf3bbf83ee76322828a38814b483fa2b337bd60
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/event/entity/EntityTeleportHinderedEvent.java
@@ -0,0 +1,117 @@
@@ -0,0 +1,114 @@
+package org.purpurmc.purpur.event.entity;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.ApiStatus;
+import org.jspecify.annotations.NullMarked;
+import org.jspecify.annotations.Nullable;
+
+/**
+ * Fired when an entity is hindered from teleporting.
+ */
+@NullMarked
+public class EntityTeleportHinderedEvent extends EntityEvent {
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ private final Reason reason;
+
+ @Nullable
+ private final TeleportCause teleportCause;
+ private final @Nullable TeleportCause teleportCause;
+
+ private boolean retry = false;
+
+ public EntityTeleportHinderedEvent(@NotNull Entity what, @NotNull Reason reason,
+ @Nullable TeleportCause teleportCause) {
+ @ApiStatus.Internal
+ public EntityTeleportHinderedEvent(Entity what, Reason reason, @Nullable TeleportCause teleportCause) {
+ super(what);
+ this.reason = reason;
+ this.teleportCause = teleportCause;
@@ -55,7 +55,6 @@ index 0000000000000000000000000000000000000000..c66eb163877e872f234d86dc244cab7e
+ /**
+ * @return why the teleport was hindered.
+ */
+ @NotNull
+ public Reason getReason() {
+ return reason;
+ }
@@ -106,12 +105,10 @@ index 0000000000000000000000000000000000000000..c66eb163877e872f234d86dc244cab7e
+ }
+
+ @Override
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }