SPIGOT-6918: Add SpawnCategory API and configurations for Axolotls

By: Doc <nachito94@msn.com>
This commit is contained in:
Bukkit/Spigot
2022-02-07 18:47:24 +11:00
parent 7c667b37d9
commit dd8840cd02
5 changed files with 297 additions and 1 deletions

View File

@@ -27,6 +27,7 @@ import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.SpawnCategory;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.generator.ChunkGenerator;
@@ -341,7 +342,9 @@ public interface Server extends PluginMessageRecipient {
* Minecraft default: 400.
*
* @return the default ticks per animal spawns value
* @deprecated Deprecated in favor of {@link #getTicksPerSpawns(SpawnCategory)}
*/
@Deprecated
public int getTicksPerAnimalSpawns();
/**
@@ -362,7 +365,9 @@ public interface Server extends PluginMessageRecipient {
* Minecraft default: 1.
*
* @return the default ticks per monsters spawn value
* @deprecated Deprecated in favor of {@link #getTicksPerSpawns(SpawnCategory)}
*/
@Deprecated
public int getTicksPerMonsterSpawns();
/**
@@ -382,7 +387,9 @@ public interface Server extends PluginMessageRecipient {
* Minecraft default: 1.
*
* @return the default ticks per water mobs spawn value
* @deprecated Deprecated in favor of {@link #getTicksPerSpawns(SpawnCategory)}
*/
@Deprecated
public int getTicksPerWaterSpawns();
/**
@@ -402,7 +409,9 @@ public interface Server extends PluginMessageRecipient {
* Minecraft default: 1.
*
* @return the default ticks per water ambient mobs spawn value
* @deprecated Deprecated in favor of {@link #getTicksPerSpawns(SpawnCategory)}
*/
@Deprecated
public int getTicksPerWaterAmbientSpawns();
/**
@@ -422,7 +431,9 @@ public interface Server extends PluginMessageRecipient {
* Minecraft default: 1.
*
* @return the default ticks per water underground creature spawn value
* @deprecated Deprecated in favor of {@link #getTicksPerSpawns(SpawnCategory)}
*/
@Deprecated
public int getTicksPerWaterUndergroundCreatureSpawns();
/**
@@ -442,9 +453,34 @@ public interface Server extends PluginMessageRecipient {
* Minecraft default: 1.
*
* @return the default ticks per ambient mobs spawn value
* @deprecated Deprecated in favor of {@link #getTicksPerSpawns(SpawnCategory)}
*/
@Deprecated
public int getTicksPerAmbientSpawns();
/**
* Gets the default ticks per {@link SpawnCategory} spawns value.
* <p>
* <b>Example Usage:</b>
* <ul>
* <li>A value of 1 will mean the server will attempt to spawn {@link SpawnCategory} mobs
* every tick.
* <li>A value of 400 will mean the server will attempt to spawn {@link SpawnCategory} mobs
* every 400th tick.
* <li>A value below 0 will be reset back to Minecraft's default.
* </ul>
* <p>
* <b>Note:</b> If set to 0, {@link SpawnCategory} mobs spawning will be disabled.
* <p>
* Minecraft default: 1.
* <br>
* <b>Note: </b> the {@link SpawnCategory#MISC} are not consider.
*
* @param spawnCategory the category of spawn
* @return the default ticks per {@link SpawnCategory} mobs spawn value
*/
public int getTicksPerSpawns(@NotNull SpawnCategory spawnCategory);
/**
* Gets a player object by the given username.
* <p>
@@ -1112,7 +1148,9 @@ public interface Server extends PluginMessageRecipient {
* chunk.
*
* @return the monster spawn limit
* @deprecated Deprecated in favor of {@link #getSpawnLimit(SpawnCategory)}
*/
@Deprecated
int getMonsterSpawnLimit();
/**
@@ -1120,7 +1158,9 @@ public interface Server extends PluginMessageRecipient {
* chunk.
*
* @return the animal spawn limit
* @deprecated Deprecated in favor of {@link #getSpawnLimit(SpawnCategory)}
*/
@Deprecated
int getAnimalSpawnLimit();
/**
@@ -1128,7 +1168,9 @@ public interface Server extends PluginMessageRecipient {
* a chunk.
*
* @return the water animal spawn limit
* @deprecated Deprecated in favor of {@link #getSpawnLimit(SpawnCategory)}
*/
@Deprecated
int getWaterAnimalSpawnLimit();
/**
@@ -1136,14 +1178,18 @@ public interface Server extends PluginMessageRecipient {
* in a chunk.
*
* @return the water ambient spawn limit
* @deprecated Deprecated in favor of {@link #getSpawnLimit(SpawnCategory)}
*/
@Deprecated
int getWaterAmbientSpawnLimit();
/**
* Get user-specified limit for number of water creature underground that can spawn
* in a chunk.
* @return the water underground creature limit
* @deprecated Deprecated in favor of {@link #getSpawnLimit(SpawnCategory)}
*/
@Deprecated
int getWaterUndergroundCreatureSpawnLimit();
/**
@@ -1151,9 +1197,22 @@ public interface Server extends PluginMessageRecipient {
* a chunk.
*
* @return the ambient spawn limit
* @deprecated Deprecated in favor of {@link #getSpawnLimit(SpawnCategory)}
*/
@Deprecated
int getAmbientSpawnLimit();
/**
* Gets user-specified limit for number of {@link SpawnCategory} mobs that can spawn in
* a chunk.
*
* <b>Note: the {@link SpawnCategory#MISC} are not consider.</b>
*
* @param spawnCategory the category spawn
* @return the {@link SpawnCategory} spawn limit
*/
int getSpawnLimit(@NotNull SpawnCategory spawnCategory);
/**
* Checks the current thread against the expected primary thread for the
* server.