#799: Adjust CreatureSpawner to allow for spawners with no mob type

By: Doc <nachito94@msn.com>
This commit is contained in:
Bukkit/Spigot
2023-06-11 11:05:12 +10:00
parent 3d755c36f5
commit 486c2ad801

View File

@@ -1,7 +1,7 @@
package org.bukkit.block; package org.bukkit.block;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;
/** /**
* Represents a captured state of a creature spawner. * Represents a captured state of a creature spawner.
@@ -11,36 +11,36 @@ public interface CreatureSpawner extends TileState {
/** /**
* Get the spawner's creature type. * Get the spawner's creature type.
* *
* @return The creature type. * @return The creature type or null if it not set.
*/ */
@NotNull @Nullable
public EntityType getSpawnedType(); public EntityType getSpawnedType();
/** /**
* Set the spawner's creature type. * Set the spawner's creature type.
* *
* @param creatureType The creature type. * @param creatureType The creature type or null to clear.
*/ */
public void setSpawnedType(@NotNull EntityType creatureType); public void setSpawnedType(@Nullable EntityType creatureType);
/** /**
* Set the spawner mob type. * Set the spawner mob type.
* *
* @param creatureType The creature type's name. * @param creatureType The creature type's name or null to clear.
* @deprecated magic value, use * @deprecated magic value, use
* {@link #setSpawnedType(org.bukkit.entity.EntityType)}. * {@link #setSpawnedType(org.bukkit.entity.EntityType)}.
*/ */
@Deprecated @Deprecated
public void setCreatureTypeByName(@NotNull String creatureType); public void setCreatureTypeByName(@Nullable String creatureType);
/** /**
* Get the spawner's creature type. * Get the spawner's creature type.
* *
* @return The creature type's name. * @return The creature type's name if is set.
* @deprecated magic value, use {@link #getSpawnedType()}. * @deprecated magic value, use {@link #getSpawnedType()}.
*/ */
@Deprecated @Deprecated
@NotNull @Nullable
public String getCreatureTypeName(); public String getCreatureTypeName();
/** /**
@@ -68,7 +68,7 @@ public interface CreatureSpawner extends TileState {
* This value is used when the spawner resets its delay (for any reason). * This value is used when the spawner resets its delay (for any reason).
* It will choose a random number between {@link #getMinSpawnDelay()} * It will choose a random number between {@link #getMinSpawnDelay()}
* and {@link #getMaxSpawnDelay()} for its next {@link #getDelay()}. * and {@link #getMaxSpawnDelay()} for its next {@link #getDelay()}.
* * <br>
* Default value is 200 ticks. * Default value is 200 ticks.
* *
* @return the minimum spawn delay amount * @return the minimum spawn delay amount
@@ -92,7 +92,7 @@ public interface CreatureSpawner extends TileState {
* <br> * <br>
* This value <b>must</b> be greater than 0 and less than or equal to * This value <b>must</b> be greater than 0 and less than or equal to
* {@link #getMaxSpawnDelay()}. * {@link #getMaxSpawnDelay()}.
* * <br>
* Default value is 800 ticks. * Default value is 800 ticks.
* *
* @return the maximum spawn delay amount * @return the maximum spawn delay amount