Search in sources :

Example 1 with Task

use of org.spongepowered.api.scheduler.Task in project Skree by Skelril.

the class ShutdownServiceImpl method shutdown.

@Override
public boolean shutdown(int seconds, long downtime, Text message) {
    if (seconds < 1) {
        return false;
    }
    reopenDate = PrettyText.dateFromCur(System.currentTimeMillis() + downtime + (seconds * 1000));
    if (runnable != null) {
        runnable.setTimes(seconds);
        return true;
    }
    IntegratedRunnable shutdown = new IntegratedRunnable() {

        @Override
        public boolean run(int times) {
            if (filter.matchesFilter(times)) {
                String rawMessage = "Sever shutting down in " + times + " seconds - for " + reopenDate + ".";
                MessageChannel.TO_ALL.send(Text.of(TextColors.RED, rawMessage));
                GameChatterPlugin.inst().sendSystemMessage(rawMessage);
            }
            return true;
        }

        @Override
        public void end() {
            String rawMessage = "Server shutting down!";
            MessageChannel.TO_ALL.send(Text.of(TextColors.RED, rawMessage));
            GameChatterPlugin.inst().sendSystemMessage(rawMessage);
            forceShutdown(message);
        }
    };
    TimedRunnable<IntegratedRunnable> runnable = new TimedRunnable<>(shutdown, seconds);
    Task task = Task.builder().execute(runnable).interval(1, TimeUnit.SECONDS).submit(SkreePlugin.inst());
    runnable.setTask(task);
    this.runnable = runnable;
    return true;
}
Also used : Task(org.spongepowered.api.scheduler.Task) IntegratedRunnable(com.skelril.nitro.time.IntegratedRunnable) TimedRunnable(com.skelril.nitro.time.TimedRunnable)

Example 2 with Task

use of org.spongepowered.api.scheduler.Task in project Skree by Skelril.

the class ShnugglesPrimeInstance method runAttack.

public void runAttack(ShnugglesPrimeAttack attackCase) {
    Optional<Giant> optBoss = getBoss();
    if (!optBoss.isPresent()) {
        return;
    }
    Giant boss = optBoss.get();
    double bossHealth = getHealth(boss);
    double maxBossHealth = getMaxHealth(boss);
    double delay = 15000;
    if (lastAttackTime != 0 && System.currentTimeMillis() - lastAttackTime <= delay) {
        return;
    }
    Collection<Player> contained = getPlayers(PARTICIPANT);
    if (contained.isEmpty()) {
        return;
    }
    // AI-ish system
    if ((attackCase == ShnugglesPrimeAttack.EVERLASTING || attackCase == ShnugglesPrimeAttack.MINION_LEECH) && bossHealth > maxBossHealth * .9) {
        attackCase = Probability.getChance(2) ? ShnugglesPrimeAttack.DARK_POTIONS : ShnugglesPrimeAttack.CORRUPTION;
    }
    for (Player player : contained) {
        if (player.get(Keys.HEALTH).get() < 4) {
            attackCase = ShnugglesPrimeAttack.CORRUPTION;
            break;
        }
    }
    Collection<Zombie> zombies = getContained(Zombie.class);
    if (zombies.size() > 200) {
        attackCase = ShnugglesPrimeAttack.BASK_IN_MY_GLORY;
    }
    if (bossHealth < maxBossHealth * .4 && Probability.getChance(5)) {
        if (zombies.size() < 100 && bossHealth > 200) {
            attackCase = ShnugglesPrimeAttack.EVERLASTING;
        } else {
            attackCase = ShnugglesPrimeAttack.MINION_LEECH;
        }
    }
    if ((attackCase == ShnugglesPrimeAttack.BLINDNESS || attackCase == ShnugglesPrimeAttack.FIRE) && bossHealth < maxBossHealth * .15) {
        runRandomAttack();
        return;
    }
    switch(attackCase) {
        case WRATH:
            sendAttackBroadcast("Taste my wrath!", AttackSeverity.NORMAL);
            for (Player player : contained) {
                player.offer(Keys.VELOCITY, new Vector3d(random.nextDouble() * 3 - 1.5, random.nextDouble() * 1 + .5, random.nextDouble() * 3 - 1.5));
                player.offer(Keys.FIRE_TICKS, 20 * 3);
            }
            break;
        case CORRUPTION:
            sendAttackBroadcast("Embrace my corruption!", AttackSeverity.NORMAL);
            PotionEffect witherEffect = PotionEffect.of(PotionEffectTypes.WITHER, 1, 20 * 3);
            for (Player player : contained) {
                List<PotionEffect> potionEffects = player.getOrElse(Keys.POTION_EFFECTS, new ArrayList<>(1));
                potionEffects.add(witherEffect);
                player.offer(Keys.POTION_EFFECTS, potionEffects);
            }
            break;
        case BLINDNESS:
            sendAttackBroadcast("Are you BLIND? Mwhahahaha!", AttackSeverity.NORMAL);
            PotionEffect blindnessEffect = PotionEffect.of(PotionEffectTypes.BLINDNESS, 0, 20 * 4);
            for (Player player : contained) {
                List<PotionEffect> potionEffects = player.getOrElse(Keys.POTION_EFFECTS, new ArrayList<>(1));
                potionEffects.add(blindnessEffect);
                player.offer(Keys.POTION_EFFECTS, potionEffects);
            }
            break;
        case TANGO_TIME:
            sendAttackBroadcast("Tango time!", AttackSeverity.ULTIMATE);
            activeAttacks.add(ShnugglesPrimeAttack.TANGO_TIME);
            Task.builder().delay(7, TimeUnit.SECONDS).execute(() -> {
                if (!isBossSpawned())
                    return;
                for (Player player : getPlayers(PARTICIPANT)) {
                    // TODO Convert to Sponge
                    if (((EntityGiantZombie) boss).canEntityBeSeen(tf(player))) {
                        player.sendMessage(Text.of(TextColors.YELLOW, "Come closer..."));
                        player.setLocation(boss.getLocation());
                        EntityDamageSource source = EntityDamageSource.builder().entity(boss).type(DamageTypes.ATTACK).build();
                        player.damage(100, source, Cause.source(boss).build());
                        player.offer(Keys.VELOCITY, new Vector3d(random.nextDouble() * 1.7 - 1.5, random.nextDouble() * 2, random.nextDouble() * 1.7 - 1.5));
                    } else {
                        player.sendMessage(Text.of(TextColors.YELLOW, "Fine... No tango this time..."));
                    }
                }
                sendAttackBroadcast("Now wasn't that fun?", AttackSeverity.INFO);
                activeAttacks.remove(ShnugglesPrimeAttack.TANGO_TIME);
            }).submit(SkreePlugin.inst());
            break;
        case EVERLASTING:
            if (!damageHeals) {
                activeAttacks.add(ShnugglesPrimeAttack.EVERLASTING);
                sendAttackBroadcast("I am everlasting!", AttackSeverity.NORMAL);
                damageHeals = true;
                Task.builder().delay(12, TimeUnit.SECONDS).execute(() -> {
                    if (damageHeals) {
                        damageHeals = false;
                        if (!isBossSpawned())
                            return;
                        sendAttackBroadcast("Thank you for your assistance.", AttackSeverity.INFO);
                    }
                    activeAttacks.remove(ShnugglesPrimeAttack.EVERLASTING);
                }).submit(SkreePlugin.inst());
                break;
            }
            runRandomAttack();
            return;
        case FIRE:
            sendAttackBroadcast("Fire is your friend...", AttackSeverity.NORMAL);
            for (Player player : contained) {
                player.offer(Keys.FIRE_TICKS, 20 * 5);
            }
            break;
        case BASK_IN_MY_GLORY:
            if (!damageHeals) {
                sendAttackBroadcast("Bask in my glory!", AttackSeverity.ULTIMATE);
                activeAttacks.add(ShnugglesPrimeAttack.BASK_IN_MY_GLORY);
                Task.builder().delay(7, TimeUnit.SECONDS).execute(() -> {
                    if (!isBossSpawned())
                        return;
                    boolean baskInGlory = false;
                    for (Player player : getContained(Player.class)) {
                        // TODO Convert to Sponge
                        if (((EntityGiantZombie) boss).canEntityBeSeen(tf(player))) {
                            player.sendMessage(Text.of(TextColors.DARK_RED, "You!"));
                            baskInGlory = true;
                        }
                    }
                    //Attack
                    if (baskInGlory) {
                        damageHeals = true;
                        spawnPts.stream().filter(pt -> Probability.getChance(12)).forEach(pt -> {
                            Explosion explosion = Explosion.builder().shouldDamageEntities(true).location(pt).radius(10).build();
                            getRegion().getExtent().triggerExplosion(explosion, Cause.source(SkreePlugin.container()).owner(boss).build());
                        });
                        //Schedule Reset
                        Task.builder().delay(500, TimeUnit.MILLISECONDS).execute(() -> {
                            damageHeals = false;
                        }).submit(SkreePlugin.inst());
                        return;
                    }
                    // Notify if avoided
                    sendAttackBroadcast("Gah... Afraid are you friends?", AttackSeverity.INFO);
                    activeAttacks.remove(ShnugglesPrimeAttack.BASK_IN_MY_GLORY);
                }).submit(SkreePlugin.inst());
                break;
            }
            runRandomAttack();
            break;
        case DARK_POTIONS:
            sendAttackBroadcast("Unleash the inner darkness!", AttackSeverity.NORMAL);
            PotionEffect instantDamageEffect = PotionEffect.of(PotionEffectTypes.INSTANT_DAMAGE, 0, 1);
            for (Living entity : getContained(Zombie.class)) {
                if (!Probability.getChance(5)) {
                    continue;
                }
                entity.offer(Keys.HEALTH, 0D);
                Location targetLoc = entity.getLocation();
                Entity potion = getRegion().getExtent().createEntity(EntityTypes.SPLASH_POTION, targetLoc.getPosition());
                potion.offer(Keys.POTION_EFFECTS, Lists.newArrayList(instantDamageEffect));
                getRegion().getExtent().spawnEntity(potion, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
            }
            return;
        case MINION_LEECH:
            sendAttackBroadcast("My minions our time is now!", AttackSeverity.ULTIMATE);
            activeAttacks.add(ShnugglesPrimeAttack.MINION_LEECH);
            IntegratedRunnable minionEater = new IntegratedRunnable() {

                @Override
                public boolean run(int times) {
                    if (!isBossSpawned())
                        return true;
                    for (Living entity : getContained(Living.class)) {
                        // TODO convert to Sponge
                        if (entity instanceof Giant || !Probability.getChance(5) || !((EntityGiantZombie) boss).canEntityBeSeen((EntityLivingBase) entity)) {
                            continue;
                        }
                        double realDamage = entity.get(Keys.HEALTH).get();
                        // TODO convert to Sponge
                        if (entity instanceof Zombie && ((EntityZombie) entity).isChild()) {
                            entity.offer(Keys.HEALTH, 0D);
                        } else {
                            DamageSource source = DamageSource.builder().type(DamageTypes.ATTACK).build();
                            entity.damage(realDamage, source, Cause.source(boss).build());
                        }
                        toHeal += Math.min(1, realDamage / 3);
                    }
                    if (new TimeFilter(-1, 2).matchesFilter(times + 1)) {
                        getPlayerMessageChannel(SPECTATOR).send(Text.of(TextColors.DARK_AQUA, "The boss has drawn in: " + (int) toHeal + " health."));
                    }
                    return true;
                }

                @Override
                public void end() {
                    if (!isBossSpawned())
                        return;
                    heal(boss, toHeal);
                    toHeal = 0;
                    sendAttackBroadcast("Thank you my minions!", AttackSeverity.INFO);
                    printBossHealth();
                    activeAttacks.remove(ShnugglesPrimeAttack.MINION_LEECH);
                }
            };
            TimedRunnable<IntegratedRunnable> minonEatingTask = new TimedRunnable<>(minionEater, 20);
            Task minionEatingTaskExecutor = Task.builder().interval(500, TimeUnit.MILLISECONDS).execute(minonEatingTask).submit(SkreePlugin.inst());
            minonEatingTask.setTask(minionEatingTaskExecutor);
            break;
    }
    lastAttackTime = System.currentTimeMillis();
    lastAttack = attackCase;
}
Also used : Boss(com.skelril.openboss.Boss) BossManager(com.skelril.openboss.BossManager) SpawnCause(org.spongepowered.api.event.cause.entity.spawn.SpawnCause) DamageSource(org.spongepowered.api.event.cause.entity.damage.source.DamageSource) TimedRunnable(com.skelril.nitro.time.TimedRunnable) PotionEffectTypes(org.spongepowered.api.effect.potion.PotionEffectTypes) SkreePlugin(com.skelril.skree.SkreePlugin) TextColor(org.spongepowered.api.text.format.TextColor) TimeFilter(com.skelril.nitro.time.TimeFilter) PotionEffect(org.spongepowered.api.effect.potion.PotionEffect) ZoneBossDetail(com.skelril.skree.content.zone.ZoneBossDetail) Living(org.spongepowered.api.entity.living.Living) ForgeTransformer.tf(com.skelril.nitro.transformer.ForgeTransformer.tf) Location(org.spongepowered.api.world.Location) BlockTypes(org.spongepowered.api.block.BlockTypes) DamageTypes(org.spongepowered.api.event.cause.entity.damage.DamageTypes) CustomItemTypes(com.skelril.skree.content.registry.item.CustomItemTypes) Cause(org.spongepowered.api.event.cause.Cause) Explosion(org.spongepowered.api.world.explosion.Explosion) World(org.spongepowered.api.world.World) BlockType(org.spongepowered.api.block.BlockType) Player(org.spongepowered.api.entity.living.player.Player) Giant(org.spongepowered.api.entity.living.monster.Giant) EntityHealthPrinter(com.skelril.nitro.entity.EntityHealthPrinter) EntityDamageSource(org.spongepowered.api.event.cause.entity.damage.source.EntityDamageSource) EntityHealthUtil(com.skelril.nitro.entity.EntityHealthUtil) LegacyZoneBase(com.skelril.skree.content.zone.LegacyZoneBase) java.util(java.util) Keys(org.spongepowered.api.data.key.Keys) EntityZombie(net.minecraft.entity.monster.EntityZombie) PARTICIPANT(com.skelril.skree.service.internal.zone.PlayerClassifier.PARTICIPANT) Vector3d(com.flowpowered.math.vector.Vector3d) IntegratedRunnable(com.skelril.nitro.time.IntegratedRunnable) Lists(com.google.common.collect.Lists) EntityTypes(org.spongepowered.api.entity.EntityTypes) Text(org.spongepowered.api.text.Text) ZoneRegion(com.skelril.skree.service.internal.zone.ZoneRegion) Task(org.spongepowered.api.scheduler.Task) ZoneStatus(com.skelril.skree.service.internal.zone.ZoneStatus) Probability(com.skelril.nitro.probability.Probability) Zombie(org.spongepowered.api.entity.living.monster.Zombie) TextColors(org.spongepowered.api.text.format.TextColors) Nullable(javax.annotation.Nullable) PlaceHolderText(com.skelril.nitro.text.PlaceHolderText) Zone(com.skelril.skree.service.internal.zone.Zone) Entity(org.spongepowered.api.entity.Entity) SPECTATOR(com.skelril.skree.service.internal.zone.PlayerClassifier.SPECTATOR) TimeUnit(java.util.concurrent.TimeUnit) SpawnTypes(org.spongepowered.api.event.cause.entity.spawn.SpawnTypes) EntityLivingBase(net.minecraft.entity.EntityLivingBase) Vector3i(com.flowpowered.math.vector.Vector3i) CombinedText(com.skelril.nitro.text.CombinedText) EntityGiantZombie(net.minecraft.entity.monster.EntityGiantZombie) Clause(com.skelril.nitro.Clause) Entity(org.spongepowered.api.entity.Entity) Player(org.spongepowered.api.entity.living.player.Player) Task(org.spongepowered.api.scheduler.Task) Explosion(org.spongepowered.api.world.explosion.Explosion) DamageSource(org.spongepowered.api.event.cause.entity.damage.source.DamageSource) EntityDamageSource(org.spongepowered.api.event.cause.entity.damage.source.EntityDamageSource) EntityZombie(net.minecraft.entity.monster.EntityZombie) Zombie(org.spongepowered.api.entity.living.monster.Zombie) EntityGiantZombie(net.minecraft.entity.monster.EntityGiantZombie) PotionEffect(org.spongepowered.api.effect.potion.PotionEffect) Living(org.spongepowered.api.entity.living.Living) TimeFilter(com.skelril.nitro.time.TimeFilter) EntityGiantZombie(net.minecraft.entity.monster.EntityGiantZombie) TimedRunnable(com.skelril.nitro.time.TimedRunnable) EntityDamageSource(org.spongepowered.api.event.cause.entity.damage.source.EntityDamageSource) Vector3d(com.flowpowered.math.vector.Vector3d) IntegratedRunnable(com.skelril.nitro.time.IntegratedRunnable) Giant(org.spongepowered.api.entity.living.monster.Giant) Location(org.spongepowered.api.world.Location)

Example 3 with Task

use of org.spongepowered.api.scheduler.Task in project Skree by Skelril.

the class FreakyFourInstance method createWall.

private void createWall(ZoneBoundingBox region, Predicate<BlockType> oldExpr, Predicate<BlockType> newExpr, BlockType oldType, BlockType newType, int density, int floodFloor) {
    final Vector3i min = region.getMinimumPoint();
    final Vector3i max = region.getMaximumPoint();
    int minX = min.getX();
    int minY = min.getY();
    int minZ = min.getZ();
    int maxX = max.getX();
    int maxY = max.getY();
    int maxZ = max.getZ();
    int initialTimes = maxZ - minZ + 1;
    IntegratedRunnable integratedRunnable = new IntegratedRunnable() {

        @Override
        public boolean run(int times) {
            int startZ = minZ + (initialTimes - times) - 1;
            for (int x = minX; x <= maxX; ++x) {
                for (int z = startZ; z < Math.min(maxZ, startZ + 4); ++z) {
                    boolean flood = Probability.getChance(density);
                    for (int y = minY; y <= maxY; ++y) {
                        BlockType block = getRegion().getExtent().getBlockType(x, y, z);
                        if (z == startZ && newExpr.test(block)) {
                            getRegion().getExtent().setBlockType(x, y, z, oldType, Cause.source(SkreePlugin.container()).build());
                        } else if (flood && oldExpr.test(block)) {
                            getRegion().getExtent().setBlockType(x, y, z, newType, Cause.source(SkreePlugin.container()).build());
                        }
                    }
                }
            }
            return true;
        }

        @Override
        public void end() {
            if (floodFloor != -1) {
                for (int x = minX; x <= maxX; ++x) {
                    for (int z = minZ; z <= maxZ; ++z) {
                        if (!Probability.getChance(floodFloor))
                            continue;
                        BlockType block = getRegion().getExtent().getBlockType(x, minY, z);
                        if (oldExpr.test(block)) {
                            getRegion().getExtent().setBlockType(x, minY, z, newType, Cause.source(SkreePlugin.container()).build());
                        }
                    }
                }
            }
        }
    };
    TimedRunnable<IntegratedRunnable> timedRunnable = new TimedRunnable<>(integratedRunnable, initialTimes);
    Task task = Task.builder().execute(timedRunnable).interval(500, MILLISECONDS).submit(SkreePlugin.inst());
    timedRunnable.setTask(task);
}
Also used : Task(org.spongepowered.api.scheduler.Task) IntegratedRunnable(com.skelril.nitro.time.IntegratedRunnable) BlockType(org.spongepowered.api.block.BlockType) Vector3i(com.flowpowered.math.vector.Vector3i) TimedRunnable(com.skelril.nitro.time.TimedRunnable)

Example 4 with Task

use of org.spongepowered.api.scheduler.Task in project HuskyCrates-Sponge by codeHusky.

the class HuskyCrates method postGameStart.

@Listener(order = Order.POST)
public void postGameStart(GameStartedServerEvent event) {
    Sponge.getScheduler().createTaskBuilder().async().execute(new Consumer<Task>() {

        @Override
        public void accept(Task task) {
            try {
                JSONObject obj = JsonReader.readJsonFromUrl("https://api.github.com/repos/codehusky/HuskyCrates-Sponge/releases");
                String[] thisVersion = pC.getVersion().get().split("\\.");
                String[] remoteVersion = obj.getJSONArray("releases").getJSONObject(0).getString("tag_name").replace("v", "").split("\\.");
                for (int i = 0; i < Math.min(remoteVersion.length, thisVersion.length); i++) {
                    if (!thisVersion[i].equals(remoteVersion[i])) {
                        if (Integer.parseInt(thisVersion[i]) > Integer.parseInt(remoteVersion[i])) {
                            //we're ahead
                            logger.warn("----------------------------------------------------");
                            logger.warn("Running unreleased version. (Developer build?)");
                            logger.warn("----------------------------------------------------");
                        } else {
                            //we're behind
                            logger.warn("----------------------------------------------------");
                            logger.warn("Your version of HuskyCrates is out of date!");
                            logger.warn("Your version: v" + pC.getVersion().get());
                            logger.warn("Latest version: " + obj.getJSONArray("releases").getJSONObject(0).getString("tag_name"));
                            logger.warn("Update here: https://goo.gl/hgtPMR");
                            logger.warn("----------------------------------------------------");
                        }
                        return;
                    }
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }).submit(this);
    Sponge.getScheduler().createTaskBuilder().execute(new Consumer<Task>() {

        @Override
        public void accept(Task task) {
            logger.info("Deleting existing armor stands...");
            for (World bit : Sponge.getServer().getWorlds()) {
                for (Entity ent : bit.getEntities()) {
                    if (ent instanceof ArmorStand) {
                        ArmorStand arm = (ArmorStand) ent;
                        if (arm.getCreator().isPresent()) {
                            if (arm.getCreator().get().equals(UUID.fromString(armorStandIdentifier))) {
                                arm.remove();
                            }
                        }
                    }
                }
            }
            logger.info("Initalizing config...");
            if (!crateUtilities.hasInitalizedVirtualCrates) {
                crateUtilities.generateVirtualCrates(crateConfig);
            }
            // doublecheck
            crateUtilities.hasInitalizedVirtualCrates = true;
            logger.info("Done initalizing config.");
            logger.info("Populating physical crates...");
            CommentedConfigurationNode root = null;
            try {
                root = crateConfig.load();
                double max = root.getNode("positions").getChildrenList().size();
                double count = 0;
                for (CommentedConfigurationNode node : root.getNode("positions").getChildrenList()) {
                    count++;
                    Location<World> ee;
                    try {
                        ee = node.getNode("location").getValue(TypeToken.of(Location.class));
                    } catch (InvalidDataException err2) {
                        logger.warn("Bug sponge developers about world UUIDs!");
                        ee = new Location<World>(Sponge.getServer().getWorld(node.getNode("location", "WorldName").getString()).get(), node.getNode("location", "X").getDouble(), node.getNode("location", "Y").getDouble(), node.getNode("location", "Z").getDouble());
                    }
                    if (!crateUtilities.physicalCrates.containsKey(ee))
                        crateUtilities.physicalCrates.put(ee, new PhysicalCrate(ee, node.getNode("crateID").getString(), HuskyCrates.instance));
                    logger.info("PROGRESS: " + Math.round((count / max) * 100) + "%");
                }
            } catch (IOException e) {
                e.printStackTrace();
            } catch (ObjectMappingException e) {
                e.printStackTrace();
            }
            crateUtilities.startParticleEffects();
            logger.info("Done populating physical crates.");
            logger.info("Initalization complete.");
        }
    }).delayTicks(1).submit(this);
}
Also used : Entity(org.spongepowered.api.entity.Entity) Task(org.spongepowered.api.scheduler.Task) PhysicalCrate(pw.codehusky.huskycrates.crate.PhysicalCrate) IOException(java.io.IOException) World(org.spongepowered.api.world.World) Consumer(java.util.function.Consumer) JSONObject(org.json.JSONObject) ArmorStand(org.spongepowered.api.entity.living.ArmorStand) CommentedConfigurationNode(ninja.leaping.configurate.commented.CommentedConfigurationNode) InvalidDataException(org.spongepowered.api.data.persistence.InvalidDataException) Location(org.spongepowered.api.world.Location) ObjectMappingException(ninja.leaping.configurate.objectmapping.ObjectMappingException) Listener(org.spongepowered.api.event.Listener)

Example 5 with Task

use of org.spongepowered.api.scheduler.Task in project Skree by Skelril.

the class WildernessWorldWrapper method addPool.

private void addPool(Location<World> block, Supplier<Collection<ItemStackSnapshot>> itemStackSupplier) {
    Optional<Integer> optLevel = getLevel(block);
    Validate.isTrue(optLevel.isPresent());
    int level = optLevel.get();
    int times = Probability.getRandom(getOreMod(getDropTier(level)));
    WildernessDropPool dropPool = new WildernessDropPool(block, itemStackSupplier, times);
    TimedRunnable<IntegratedRunnable> runnable = new TimedRunnable<>(dropPool, times);
    Task task = Task.builder().execute(runnable).delay(1, SECONDS).interval(1, SECONDS).submit(SkreePlugin.inst());
    runnable.setTask(task);
}
Also used : Task(org.spongepowered.api.scheduler.Task) IntegratedRunnable(com.skelril.nitro.time.IntegratedRunnable) TimedRunnable(com.skelril.nitro.time.TimedRunnable)

Aggregations

Task (org.spongepowered.api.scheduler.Task)8 IntegratedRunnable (com.skelril.nitro.time.IntegratedRunnable)6 TimedRunnable (com.skelril.nitro.time.TimedRunnable)6 Vector3d (com.flowpowered.math.vector.Vector3d)2 Vector3i (com.flowpowered.math.vector.Vector3i)2 BlockType (org.spongepowered.api.block.BlockType)2 Entity (org.spongepowered.api.entity.Entity)2 Lists (com.google.common.collect.Lists)1 Clause (com.skelril.nitro.Clause)1 EntityCleanupTask (com.skelril.nitro.entity.EntityCleanupTask)1 EntityHealthPrinter (com.skelril.nitro.entity.EntityHealthPrinter)1 EntityHealthUtil (com.skelril.nitro.entity.EntityHealthUtil)1 Probability (com.skelril.nitro.probability.Probability)1 CombinedText (com.skelril.nitro.text.CombinedText)1 PlaceHolderText (com.skelril.nitro.text.PlaceHolderText)1 TimeFilter (com.skelril.nitro.time.TimeFilter)1 ForgeTransformer.tf (com.skelril.nitro.transformer.ForgeTransformer.tf)1 Boss (com.skelril.openboss.Boss)1 BossManager (com.skelril.openboss.BossManager)1 SkreePlugin (com.skelril.skree.SkreePlugin)1