Maya/src/main/java/eu/univento/maya/game/BuyCounter.java

33 lines
1.0 KiB
Java
Raw Normal View History

2016-09-17 12:04:34 +02:00
package eu.univento.maya.game;
2016-10-10 15:56:24 +02:00
import eu.univento.core.Core;
import eu.univento.core.api.player.CustomPlayer;
2016-09-17 12:04:34 +02:00
import eu.univento.maya.Maya;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.scheduler.BukkitRunnable;
/**
* @author joethei
* @version 0.1
*/
public class BuyCounter extends BukkitRunnable{
2016-10-10 16:52:10 +02:00
private int time = 60;
2016-09-17 12:04:34 +02:00
public void run() {
if(Maya.getStage() == GameStage.Buy) {
2016-10-10 15:56:24 +02:00
for(CustomPlayer players : Core.getOnlinePlayers()) {
players.sendTitle(1, 1, 1, "§6" + time, "");
2016-09-17 12:04:34 +02:00
players.playSound(players.getEyeLocation(), Sound.ENTITY_ARROW_HIT, 1.0F, 1.0F);
}
if(time == 0) {
Maya.setStage(GameStage.DeathMatch);
Maya.deathmatchID = Maya.getInstance().getServer().getScheduler().scheduleSyncRepeatingTask(Maya.getInstance(), new DeathmatchCounter(), 20L, 20L);
Bukkit.getScheduler().cancelTask(Maya.buyID);
}
time--;
}
return;
}
}