mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-20 06:43:49 -07:00
Begin switching to JSpecify annotations (#11448)
* Begin switching to JSpecify annotations * more * fixes
This commit is contained in:
@@ -20,13 +20,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a thrown egg might hatch.
|
||||
+ * <p>
|
||||
+ * This event fires for all thrown eggs that may hatch, players, dispensers, etc.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class ThrownEggHatchEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
@@ -37,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ private EntityType hatchType;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ThrownEggHatchEvent(@NotNull final Egg egg, final boolean hatching, final byte numHatches, @NotNull final EntityType hatchingType) {
|
||||
+ public ThrownEggHatchEvent(final Egg egg, final boolean hatching, final byte numHatches, final EntityType hatchingType) {
|
||||
+ this.egg = egg;
|
||||
+ this.hatching = hatching;
|
||||
+ this.numHatches = numHatches;
|
||||
@@ -49,7 +50,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ *
|
||||
+ * @return the egg involved in this event
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Egg getEgg() {
|
||||
+ return this.egg;
|
||||
+ }
|
||||
@@ -68,9 +68,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * Sets whether the egg will hatch or not.
|
||||
+ *
|
||||
+ * @param hatching {@code true} if you want the egg to hatch, {@code false} if you want it
|
||||
+ * not to
|
||||
+ * not to
|
||||
+ */
|
||||
+ public void setHatching(boolean hatching) {
|
||||
+ public void setHatching(final boolean hatching) {
|
||||
+ this.hatching = hatching;
|
||||
+ }
|
||||
+
|
||||
@@ -79,7 +79,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ *
|
||||
+ * @return The type of the mob being hatched by the egg
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public EntityType getHatchingType() {
|
||||
+ return this.hatchType;
|
||||
+ }
|
||||
@@ -89,13 +88,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ *
|
||||
+ * @param hatchType The type of the mob being hatched by the egg
|
||||
+ */
|
||||
+ public void setHatchingType(@NotNull EntityType hatchType) {
|
||||
+ public void setHatchingType(final EntityType hatchType) {
|
||||
+ Preconditions.checkArgument(hatchType.isSpawnable(), "Can't spawn that entity type from an egg!");
|
||||
+ this.hatchType = hatchType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the number of mob hatches from the egg. By default the number will
|
||||
+ * Get the number of mob hatches from the egg. By default, the number will
|
||||
+ * be the number the server would've done
|
||||
+ * <ul>
|
||||
+ * <li>7/8 chance of being 0
|
||||
@@ -117,17 +116,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ *
|
||||
+ * @param numHatches The number of mobs coming out of the egg
|
||||
+ */
|
||||
+ public void setNumHatches(byte numHatches) {
|
||||
+ public void setNumHatches(final byte numHatches) {
|
||||
+ this.numHatches = numHatches;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
Reference in New Issue
Block a user