Search in sources :

Example 1 with IslandSpawners

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;
}
Also used : StackedSpawner(dev.rosewood.rosestacker.stack.StackedSpawner) IslandSpawners(com.iridium.iridiumskyblock.database.IslandSpawners)

Example 2 with IslandSpawners

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);
        }
    });
}
Also used : Player(org.bukkit.entity.Player) User(com.iridium.iridiumskyblock.database.User) XMaterial(com.iridium.iridiumcore.dependencies.xseries.XMaterial) IslandBlocks(com.iridium.iridiumskyblock.database.IslandBlocks) CreatureSpawner(org.bukkit.block.CreatureSpawner) IslandSpawners(com.iridium.iridiumskyblock.database.IslandSpawners) EventHandler(org.bukkit.event.EventHandler)

Example 3 with IslandSpawners

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;
}
Also used : StackedSpawner(com.bgsoftware.wildstacker.api.objects.StackedSpawner) IslandSpawners(com.iridium.iridiumskyblock.database.IslandSpawners)

Aggregations

IslandSpawners (com.iridium.iridiumskyblock.database.IslandSpawners)3 StackedSpawner (com.bgsoftware.wildstacker.api.objects.StackedSpawner)1 XMaterial (com.iridium.iridiumcore.dependencies.xseries.XMaterial)1 IslandBlocks (com.iridium.iridiumskyblock.database.IslandBlocks)1 User (com.iridium.iridiumskyblock.database.User)1 StackedSpawner (dev.rosewood.rosestacker.stack.StackedSpawner)1 CreatureSpawner (org.bukkit.block.CreatureSpawner)1 Player (org.bukkit.entity.Player)1 EventHandler (org.bukkit.event.EventHandler)1