33 lines
1013 B
Java
33 lines
1013 B
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 DeathmatchCounter extends BukkitRunnable{
|
|
|
|
int time = 20;
|
|
|
|
public void run() {
|
|
if(Maya.getStage() == GameStage.DeathMatch) {
|
|
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.Restart);
|
|
Bukkit.getScheduler().cancelTask(Maya.deathmatchID);
|
|
Maya.restartID = Bukkit.getScheduler().scheduleSyncRepeatingTask(Maya.getInstance(), new RestartCounter(), 20L, 20L);
|
|
}
|
|
time--;
|
|
}
|
|
return;
|
|
}
|
|
} |