Commits
Doc authored and md_5 committed de951355626
1494 1494 | |
1495 1495 | public void setAmbientSpawnLimit(int limit) { |
1496 1496 | setSpawnLimit(SpawnCategory.AMBIENT, limit); |
1497 1497 | } |
1498 1498 | |
1499 1499 | |
1500 1500 | public int getSpawnLimit(SpawnCategory spawnCategory) { |
1501 1501 | Validate.notNull(spawnCategory, "SpawnCategory cannot be null"); |
1502 1502 | Validate.isTrue(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory." + spawnCategory + " are not supported."); |
1503 1503 | |
1504 - | int limit = spawnCategoryLimit.getInt(spawnCategory); |
1504 + | int limit = spawnCategoryLimit.getOrDefault(spawnCategory, -1); |
1505 1505 | if (limit < 0) { |
1506 1506 | limit = server.getSpawnLimit(spawnCategory); |
1507 1507 | } |
1508 1508 | return limit; |
1509 1509 | } |
1510 1510 | |
1511 1511 | |
1512 1512 | public void setSpawnLimit(SpawnCategory spawnCategory, int limit) { |
1513 1513 | Validate.notNull(spawnCategory, "SpawnCategory cannot be null"); |
1514 1514 | Validate.isTrue(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory." + spawnCategory + " are not supported."); |