Search in sources :

Example 1 with IslandBlocks

use of com.iridium.iridiumskyblock.database.IslandBlocks in project IridiumSkyblock by Iridium-Development.

the class WildStackerSupport method getExtraBlocks.

@Override
public int getExtraBlocks(Island island, XMaterial material) {
    IslandBlocks islandBlocks = IridiumSkyblock.getInstance().getIslandManager().getIslandBlock(island, material);
    int stackedBlocks = 0;
    for (StackedBarrel stackedBarrel : WildStackerAPI.getWildStacker().getSystemManager().getStackedBarrels()) {
        if (!island.isInIsland(stackedBarrel.getLocation()))
            continue;
        if (material != XMaterial.matchXMaterial(stackedBarrel.getType()))
            continue;
        if (material == XMaterial.matchXMaterial(stackedBarrel.getType())) {
            stackedBlocks--;
        } else {
            stackedBlocks += stackedBarrel.getStackAmount();
        }
    }
    islandBlocks.setExtraAmount(stackedBlocks);
    return stackedBlocks;
}
Also used : StackedBarrel(com.bgsoftware.wildstacker.api.objects.StackedBarrel) IslandBlocks(com.iridium.iridiumskyblock.database.IslandBlocks)

Example 2 with IslandBlocks

use of com.iridium.iridiumskyblock.database.IslandBlocks 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 IslandBlocks

use of com.iridium.iridiumskyblock.database.IslandBlocks in project IridiumSkyblock by Iridium-Development.

the class RoseStackerSupport method getExtraBlocks.

@Override
public int getExtraBlocks(Island island, XMaterial material) {
    IslandBlocks islandBlocks = IridiumSkyblock.getInstance().getIslandManager().getIslandBlock(island, material);
    int stackedBlocks = 0;
    for (StackedBlock stackedBlock : RoseStackerAPI.getInstance().getStackedBlocks().values()) {
        if (!island.isInIsland(stackedBlock.getLocation()))
            continue;
        if (material != XMaterial.matchXMaterial(stackedBlock.getBlock().getType()))
            continue;
        stackedBlocks += (stackedBlock.getStackSize() - 1);
    }
    islandBlocks.setExtraAmount(stackedBlocks);
    return stackedBlocks;
}
Also used : StackedBlock(dev.rosewood.rosestacker.stack.StackedBlock) IslandBlocks(com.iridium.iridiumskyblock.database.IslandBlocks)

Aggregations

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