Search in sources :

Example 51 with GameRunnable

use of com.ebicep.warlords.util.warlords.GameRunnable in project Warlords by ebicep.

the class PowerupOption method start.

@Override
public void start(Game game) {
    hasStarted = true;
    if (cooldown == 0) {
        spawn();
    }
    new GameRunnable(game) {

        @Override
        public void run() {
            if (cooldown == 0) {
                PlayerFilter.entitiesAround(location, 1.4, 1.4, 1.4).isAlive().first((nearPlayer) -> {
                    type.onPickUp(PowerupOption.this, nearPlayer);
                    remove();
                    cooldown = maxCooldown * 4;
                });
            } else {
                cooldown--;
                if (cooldown == 0) {
                    spawn();
                }
            }
        }
    }.runTaskTimer(0, 5);
}
Also used : HealingPowerup(com.ebicep.warlords.abilties.internal.HealingPowerup) Utils(com.ebicep.warlords.util.warlords.Utils) Arrays(java.util.Arrays) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable) Nonnegative(javax.annotation.Nonnegative) SpeedPowerup(com.ebicep.warlords.abilties.internal.SpeedPowerup) CooldownTypes(com.ebicep.warlords.player.cooldowns.CooldownTypes) PlayerFilter(com.ebicep.warlords.util.warlords.PlayerFilter) ItemStack(org.bukkit.inventory.ItemStack) Objects(java.util.Objects) Game(com.ebicep.warlords.game.Game) Location(org.bukkit.Location) WarlordsPlayer(com.ebicep.warlords.player.WarlordsPlayer) EnergyPowerup(com.ebicep.warlords.abilties.internal.EnergyPowerup) ArmorStand(org.bukkit.entity.ArmorStand) ChatColor(org.bukkit.ChatColor) DebugLocationMarker(com.ebicep.warlords.game.option.marker.DebugLocationMarker) TimerSkipAbleMarker(com.ebicep.warlords.game.option.marker.TimerSkipAbleMarker) DamagePowerup(com.ebicep.warlords.abilties.internal.DamagePowerup) Nonnull(javax.annotation.Nonnull) Material(org.bukkit.Material) Nullable(javax.annotation.Nullable) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable)

Example 52 with GameRunnable

use of com.ebicep.warlords.util.warlords.GameRunnable in project Warlords by ebicep.

the class SimulationTeleportOption method onFlagReturn.

@EventHandler
public void onFlagReturn(WarlordsFlagUpdatedEvent e) {
    if (e.getNew() instanceof SpawnFlagLocation) {
        preventPlayerMovement = true;
        for (WarlordsPlayer wp : PlayerFilter.playingGame(game).isAlive()) {
            wp.respawn();
        }
        new GameRunnable(game) {

            @Override
            public void run() {
                preventPlayerMovement = false;
            }
        }.runTaskLater(40);
    }
}
Also used : WarlordsPlayer(com.ebicep.warlords.player.WarlordsPlayer) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable) SpawnFlagLocation(com.ebicep.warlords.game.flags.SpawnFlagLocation) EventHandler(org.bukkit.event.EventHandler)

Example 53 with GameRunnable

use of com.ebicep.warlords.util.warlords.GameRunnable in project Warlords by ebicep.

the class FlagSpawnPointOption method start.

@Override
public void start(Game game) {
    new GameRunnable(game) {

        @Override
        public void run() {
            if (!(info.getFlag() instanceof PlayerFlagLocation)) {
                return;
            }
            PlayerFlagLocation playerFlagLocation = (PlayerFlagLocation) info.getFlag();
            if (flagIsInCaptureZone(playerFlagLocation) && !flagCaptureIsNotBlocked(playerFlagLocation)) {
                FlagHolder.update(game, info -> new WaitingFlagLocation(info.getSpawnLocation(), info.getFlag() == playerFlagLocation ? playerFlagLocation.getPlayer() : null));
            }
        }
    }.runTaskTimer(0, 4);
    new GameRunnable(game) {

        @Override
        public void run() {
            FlagLocation newFlag = info.getFlag().update(info);
            if (newFlag != null) {
                info.setFlag(newFlag);
            }
            renderer.checkRender();
        }
    }.runTaskTimer(0, 1);
}
Also used : MovingObjectPosition(net.minecraft.server.v1_8_R3.MovingObjectPosition) SimpleScoreboardHandler(com.ebicep.warlords.game.option.marker.scoreboard.SimpleScoreboardHandler) Collections.singletonList(java.util.Collections.singletonList) EventHandler(org.bukkit.event.EventHandler) Location(org.bukkit.Location) ScoreboardHandler(com.ebicep.warlords.game.option.marker.scoreboard.ScoreboardHandler) PlayerInteractEvent(org.bukkit.event.player.PlayerInteractEvent) Nonnull(javax.annotation.Nonnull) Vec3D(net.minecraft.server.v1_8_R3.Vec3D) Material(org.bukkit.Material) EntityDamageByEntityEvent(org.bukkit.event.entity.EntityDamageByEntityEvent) Nullable(javax.annotation.Nullable) Bukkit(org.bukkit.Bukkit) Listener(org.bukkit.event.Listener) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable) Entity(org.bukkit.entity.Entity) Team(com.ebicep.warlords.game.Team) com.ebicep.warlords.game.flags(com.ebicep.warlords.game.flags) Warlords(com.ebicep.warlords.Warlords) CooldownTypes(com.ebicep.warlords.player.cooldowns.CooldownTypes) PlayerInteractEntityEvent(org.bukkit.event.player.PlayerInteractEntityEvent) Vector(org.bukkit.util.Vector) List(java.util.List) Game(com.ebicep.warlords.game.Game) RegularCooldown(com.ebicep.warlords.player.cooldowns.cooldowns.RegularCooldown) EventPriority(org.bukkit.event.EventPriority) WarlordsPlayer(com.ebicep.warlords.player.WarlordsPlayer) PlayerEvent(org.bukkit.event.player.PlayerEvent) WarlordsFlagUpdatedEvent(com.ebicep.warlords.events.WarlordsFlagUpdatedEvent) ChatColor(org.bukkit.ChatColor) AxisAlignedBB(net.minecraft.server.v1_8_R3.AxisAlignedBB) WarlordsDamageHealingEvent(com.ebicep.warlords.events.WarlordsDamageHealingEvent) com.ebicep.warlords.game.option.marker(com.ebicep.warlords.game.option.marker) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable)

Aggregations

GameRunnable (com.ebicep.warlords.util.warlords.GameRunnable)53 WarlordsPlayer (com.ebicep.warlords.player.WarlordsPlayer)39 Location (org.bukkit.Location)34 Player (org.bukkit.entity.Player)23 Utils (com.ebicep.warlords.util.warlords.Utils)21 CooldownTypes (com.ebicep.warlords.player.cooldowns.CooldownTypes)17 AbstractAbility (com.ebicep.warlords.classes.AbstractAbility)16 ParticleEffect (com.ebicep.warlords.effects.ParticleEffect)16 RegularCooldown (com.ebicep.warlords.player.cooldowns.cooldowns.RegularCooldown)16 PlayerFilter (com.ebicep.warlords.util.warlords.PlayerFilter)16 WarlordsDamageHealingEvent (com.ebicep.warlords.events.WarlordsDamageHealingEvent)13 ItemStack (org.bukkit.inventory.ItemStack)13 ArmorStand (org.bukkit.entity.ArmorStand)12 Vector (org.bukkit.util.Vector)11 ChatColor (org.bukkit.ChatColor)10 Material (org.bukkit.Material)10 Warlords (com.ebicep.warlords.Warlords)9 ArrayList (java.util.ArrayList)9 List (java.util.List)9 Nonnull (javax.annotation.Nonnull)9