Begin switching to JSpecify annotations (#11448)

* Begin switching to JSpecify annotations

* more

* fixes
This commit is contained in:
Jake Potrebic
2024-09-29 12:52:13 -07:00
parent fa1f6a5d78
commit 64e918335c
62 changed files with 580 additions and 750 deletions

View File

@@ -21,28 +21,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.event.entity.EntityPortalEvent;
+import org.bukkit.event.player.PlayerPortalEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jspecify.annotations.NullMarked;
+import org.jspecify.annotations.Nullable;
+
+/**
+ * Called when an entity is ready to be teleported by a plugin.
+ * Currently this is only called after the required
+ * Currently, this is only called after the required
+ * ticks have passed for a Nether Portal.
+ * <p>
+ * Cancelling this event resets the entity's readiness
+ * regarding the current portal.
+ */
+@NullMarked
+public class EntityPortalReadyEvent extends EntityEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ private final PortalType portalType;
+ private World targetWorld;
+ private @Nullable World targetWorld;
+
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public EntityPortalReadyEvent(final @NotNull Entity entity, final @Nullable World targetWorld, final @NotNull PortalType portalType) {
+ public EntityPortalReadyEvent(final Entity entity, final @Nullable World targetWorld, final PortalType portalType) {
+ super(entity);
+ this.targetWorld = targetWorld;
+ this.portalType = portalType;
@@ -81,7 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @return the portal type
+ */
+ public @NotNull PortalType getPortalType() {
+ public PortalType getPortalType() {
+ return this.portalType;
+ }
+
@@ -96,11 +97,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ @Override
+ public @NotNull HandlerList getHandlers() {
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
+ public static @NotNull HandlerList getHandlerList() {
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }
+}