33 lines
1.0 KiB
Java
33 lines
1.0 KiB
Java
package eu.univento.maya.game;
|
|
|
|
import eu.univento.core.api.Title;
|
|
import eu.univento.maya.Maya;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.Sound;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.scheduler.BukkitRunnable;
|
|
|
|
/**
|
|
* @author joethei
|
|
* @version 0.1
|
|
*/
|
|
public class BuyCounter extends BukkitRunnable{
|
|
|
|
int time = 60;
|
|
|
|
public void run() {
|
|
if(Maya.getStage() == GameStage.Buy) {
|
|
for(Player players : Bukkit.getOnlinePlayers()) {
|
|
Title.sendTitle(players, 1, 1, 1, "§6" + time, "");
|
|
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;
|
|
}
|
|
} |