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