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

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