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;
}
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);
}
});
}
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;
}
Aggregations