use of com.iridium.iridiumskyblock.database.IslandSpawners in project IridiumSkyblock by Iridium-Development.
the class RoseStackerSupport method getExtraSpawners.
@Override
public int getExtraSpawners(Island island, EntityType entityType) {
IslandSpawners islandSpawners = IridiumSkyblock.getInstance().getIslandManager().getIslandSpawners(island, entityType);
int stackedSpawners = 0;
for (StackedSpawner stackedSpawner : RoseStackerAPI.getInstance().getStackedSpawners().values()) {
if (!island.isInIsland(stackedSpawner.getLocation()))
continue;
if (stackedSpawner.getSpawner().getSpawnedType() != entityType)
continue;
stackedSpawners += (stackedSpawner.getStackSize() - 1);
}
islandSpawners.setExtraAmount(stackedSpawners);
return stackedSpawners;
}
use of com.iridium.iridiumskyblock.database.IslandSpawners in project IridiumSkyblock by Iridium-Development.
the class BlockPlaceListener method monitorBlockPlace.
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void monitorBlockPlace(BlockPlaceEvent event) {
if (!IridiumSkyblockAPI.getInstance().isIslandWorld(event.getBlock().getWorld()))
return;
Player player = event.getPlayer();
User user = IridiumSkyblock.getInstance().getUserManager().getUser(player);
XMaterial material = XMaterial.matchXMaterial(event.getBlock().getType());
user.getIsland().ifPresent(island -> {
IridiumSkyblock.getInstance().getMissionManager().handleMissionUpdates(island, "PLACE", material.name(), 1);
IslandBlocks islandBlocks = IridiumSkyblock.getInstance().getIslandManager().getIslandBlock(island, material);
islandBlocks.setAmount(islandBlocks.getAmount() + 1);
if (event.getBlock().getState() instanceof CreatureSpawner) {
CreatureSpawner creatureSpawner = (CreatureSpawner) event.getBlock().getState();
IslandSpawners islandSpawners = IridiumSkyblock.getInstance().getIslandManager().getIslandSpawners(island, creatureSpawner.getSpawnedType());
islandSpawners.setAmount(islandSpawners.getAmount() + 1);
}
});
}
use of com.iridium.iridiumskyblock.database.IslandSpawners in project IridiumSkyblock by Iridium-Development.
the class WildStackerSupport method getExtraSpawners.
@Override
public int getExtraSpawners(Island island, EntityType entityType) {
IslandSpawners islandSpawners = IridiumSkyblock.getInstance().getIslandManager().getIslandSpawners(island, entityType);
int stackedSpawners = 0;
for (StackedSpawner stackedSpawner : WildStackerAPI.getWildStacker().getSystemManager().getStackedSpawners()) {
if (!island.isInIsland(stackedSpawner.getLocation()))
continue;
if (stackedSpawner.getSpawnedType() != entityType)
continue;
stackedSpawners += stackedSpawner.getStackAmount();
}
islandSpawners.setExtraAmount(stackedSpawners);
return stackedSpawners;
}
Aggregations