Spawn obelisks now count as spawn blocks

This commit is contained in:
kuroppoi 2022-01-14 05:32:58 +01:00
parent 52b003d7fb
commit e0d2e5c4b2
2 changed files with 4 additions and 4 deletions

View file

@ -193,7 +193,7 @@ public class Player extends Entity implements CommandExecutor {
*/
public void onZoneChanged() {
// TODO handle spawns better
MetaBlock spawn = zone.getRandomZoneTeleporter();
MetaBlock spawn = zone.getRandomSpawnBlock();
if(spawn == null) {
x = zone.getWidth() / 2;

View file

@ -614,9 +614,9 @@ public class Zone {
return metaBlocks;
}
public MetaBlock getRandomZoneTeleporter() {
List<MetaBlock> zoneTeleporters = getMetaBlocksWithUse(ItemUseType.ZONE_TELEPORT);
return zoneTeleporters.isEmpty() ? null : zoneTeleporters.get((int)(Math.random() * zoneTeleporters.size()));
public MetaBlock getRandomSpawnBlock() {
List<MetaBlock> spawnBlocks = getMetaBlocksWhere(block -> block.getItem().getId() == 891 || block.getItem().getId() == 934);
return spawnBlocks.isEmpty() ? null : spawnBlocks.get((int)(Math.random() * spawnBlocks.size()));
}
public Collection<MetaBlock> getMetaBlocks() {