Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CountdownHandler {
- public static int lobbytimer = 61;
- public static BukkitTask task1;
- public static void firstCountdown() {
- task1 = new BukkitRunnable() {
- @Override
- public void run() {
- // TODO Auto-generated method stub
- if(lobbytimer <= lobbytimer) {
- lobbytimer--;
- for(Player all : Bukkit.getOnlinePlayers()) {
- all.setLevel(lobbytimer);
- }
- if(Bukkit.getOnlinePlayers().length < 1) {
- for(Player all : Bukkit.getOnlinePlayers()) {
- all.sendMessage(SG.prefix + "§7Es sind zu wenige §3Spieler §7online!");
- }
- lobbytimer = 61;
- cancel();
- }
- }
- if(lobbytimer == 60) {
- setLocations();
- }
- if(lobbytimer == 60 || lobbytimer == 30 || lobbytimer == 15 || lobbytimer == 10 || lobbytimer == 5) {
- for(Player all : Bukkit.getOnlinePlayers()) {
- all.sendMessage(SG.prefix + "§7Das Spiel startet in §3" + lobbytimer + " §7Sekunden");
- }
- }
- if(lobbytimer == 0) {
- int intega = 0;
- int inet = intega;
- try{
- for(intega = inet; intega < Bukkit.getOnlinePlayers().length; intega++) {
- Player player = Bukkit.getOnlinePlayers()[intega];
- player.teleport(SG.spawnlocation.get(intega));
- }
- }catch(IndexOutOfBoundsException e) {
- for(intega = inet; intega < Bukkit.getOnlinePlayers().length; intega++) {
- Player player = Bukkit.getOnlinePlayers()[intega];
- player.teleport(SG.spawnlocation.get(intega));
- }
- }
- SG.status = GameStatus.NOMOVE;
- noMoveCountdown();
- cancel();
- }
- }
- }.runTaskTimer(SG.plugin, 0, 20);
- }
- public static void noMoveCountdown() {
- new BukkitRunnable() {
- int schutz= 21;
- @Override
- public void run() {
- // TODO Auto-generated method stub
- if(schutz<= schutz) {
- schutz--;
- }
- if(schutz== 20 || schutz== 10 || schutz<= 5 && schutz> 0) {
- for(Player all : SG.ingame) {
- all.sendMessage(SG.prefix + "§7Die Schutzzeit beginnt in §3" + schutz+ " §7Sekunde(n)");
- }
- }
- if(schutz== 0) {
- SG.status = GameStatus.SCHUTZ;
- schutzCountdown();
- cancel();
- }
- }
- }.runTaskTimer(SG.plugin, 0, 20);
- }
- public static void schutzCountdown() {
- new BukkitRunnable() {
- int schutz = 21;
- @Override
- public void run() {
- // TODO Auto-generated method stub
- if(schutz<= schutz) {
- schutz--;
- }
- if(schutz== 20 || schutz== 10 || schutz<= 5 && schutz> 0) {
- for(Player all : SG.ingame) {
- all.sendMessage(SG.prefix + "§7Die Schutzzeit endet in §3" + schutz+ " §7Sekunde(n)");
- }
- if(schutz == 6) {
- for(Player all : SG.ingame) {
- all.sendMessage(SG.prefix + "§7Die Kisten werden in §35 §7Sekunden neu aufgefüllt.");
- }
- }
- if(schutz == 1) {
- for(Player all : SG.ingame) {
- ChestListener.chest.clear();
- all.sendMessage(SG.prefix + "§7Die §3Kisten §7wurden aufgefüllt.");
- }
- }
- }
- if(schutz== 0) {
- SG.status = GameStatus.INGAME;
- cancel();
- }
- }
- }.runTaskTimer(SG.plugin, 0, 20);
- }
- public static void setLocations() {
- for(String s : SG.plugin.getConfig().getConfigurationSection("Spawn.").getKeys(false)) {
- if(SG.plugin.getConfig().getString("Spawn." + s + ".World") != null) {
- World w = Bukkit.getWorld(SG.plugin.getConfig().getString("Spawn." + s + ".World"));
- double x = SG.plugin.getConfig().getDouble("Spawn." + s + ".X");
- double y = SG.plugin.getConfig().getDouble("Spawn." + s + ".Y");
- double z = SG.plugin.getConfig().getDouble("Spawn." + s + ".Z");
- Location loc = new Location(w, x, y, z);
- SG.spawnlocation.add(loc);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement