Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void startCountdown() {
- this.cd = Bukkit.getScheduler().scheduleSyncRepeatingTask(getInstance(), new Runnable() {
- @Override
- public void run() {
- if(Bukkit.getOnlinePlayers().size() < 2) {
- for(Player all : Bukkit.getOnlinePlayers()) {
- all.sendMessage(prefix + "§cEs müssen mindestens §e2 §cSpieler im Spiel sein!");
- }
- return;
- }
- cdamount--;
- for(Player all : Bukkit.getOnlinePlayers()) {
- all.setLevel(cdamount);
- all.setExp((float) (cdamount)/50);
- }
- if(cdamount == 50) {
- for(Player all : Bukkit.getOnlinePlayers()) {
- all.sendMessage(prefix + "§7Das Spiel beginnt in §650 §7Sekunden!");
- all.playSound(all.getLocation(), Sound.ENTITY_ENDERDRAGON_FLAP, 1, 2);
- }
- }
- if(cdamount == 30) {
- for(Player all : Bukkit.getOnlinePlayers()) {
- all.sendMessage(prefix + "§7Das Spiel beginnt in §630 §7Sekunden!");
- all.playSound(all.getLocation(), Sound.ENTITY_ENDERDRAGON_FLAP, 1, 2);
- }
- }
- if(cdamount == 15) {
- for(Player all : Bukkit.getOnlinePlayers()) {
- all.sendMessage(prefix + "§7Das Spiel beginnt in §615 §7Sekunden!");
- all.playSound(all.getLocation(), Sound.ENTITY_ENDERDRAGON_FLAP, 1, 2);
- }
- }
- if(cdamount == 10) {
- for(Player all : Bukkit.getOnlinePlayers()) {
- all.sendMessage(prefix + "§7Das Spiel beginnt in §610 §7Sekunden!");
- all.playSound(all.getLocation(), Sound.ENTITY_ENDERDRAGON_FLAP, 1, 2);
- }
- }
- if(cdamount == 5) {
- for(Player all : Bukkit.getOnlinePlayers()) {
- all.sendMessage(prefix + "§7Das Spiel beginnt in §65 §7Sekunden!");
- all.playSound(all.getLocation(), Sound.ENTITY_ENDERDRAGON_FLAP, 1, 2);
- }
- }
- if(cdamount == 4) {
- for(Player all : Bukkit.getOnlinePlayers()) {
- all.sendMessage(prefix + "§7Das Spiel beginnt in §64 §7Sekunden!");
- all.playSound(all.getLocation(), Sound.ENTITY_ENDERDRAGON_FLAP, 1, 2);
- }
- }
- if(cdamount == 3) {
- for(Player all : Bukkit.getOnlinePlayers()) {
- all.sendMessage(prefix + "§7Das Spiel beginnt in §63 §7Sekunden!");
- all.playSound(all.getLocation(), Sound.ENTITY_ENDERDRAGON_FLAP, 1, 2);
- }
- }
- if(cdamount == 2) {
- for(Player all : Bukkit.getOnlinePlayers()) {
- all.sendMessage(prefix + "§7Das Spiel beginnt in §62 §7Sekunden!");
- all.playSound(all.getLocation(), Sound.ENTITY_ENDERDRAGON_FLAP, 1, 2);
- }
- }
- if(cdamount == 1) {
- for(Player all : Bukkit.getOnlinePlayers()) {
- all.sendMessage(prefix + "§7Das Spiel beginnt in §61 §7Sekunden!");
- all.playSound(all.getLocation(), Sound.ENTITY_ENDERDRAGON_FLAP, 1, 2);
- }
- }
- if(cdamount == 0) {
- Bukkit.getScheduler().cancelTask(cd);
- cdamount = 51;
- if(TeamBlau.size() == 0 || TeamRot.size() == 0) {
- for (Player all : Bukkit.getOnlinePlayers()) {
- all.sendMessage(prefix + "§cEs sind zu wenig Spieler in den Teams!");
- all.playSound(all.getLocation(), Sound.ENTITY_PLAYER_BURP, 1, 1);
- cdamount = -1;
- }
- return;
- }
- for(Player all : Bukkit.getOnlinePlayers()) {
- sendIngameScoreboard(all);
- all.sendMessage(prefix + "§aDas Spiel startet!");
- all.playSound(all.getLocation(), Sound.ENTITY_ENDERDRAGON_GROWL, 1, 2);
- }
- gs = GameState.INGAME;
- startBronzeSpawner();
- startEisenSpawner();
- startGoldSpawner();
- for (final Player all : Bukkit.getOnlinePlayers()) {
- if(!(TeamRot.contains(all) | TeamBlau.contains(all))) {
- int max = 0;
- int tr = TeamRot.size();
- int tb = TeamBlau.size();
- if(tr > tb) {
- TeamBlau.add(all);
- all.sendMessage(MainClass.prefix + "§7Du wurdest in das §9Team Blau §7geschoben!");
- }
- if(tb > tr) {
- TeamRot.add(all);
- all.sendMessage(MainClass.prefix + "§7Du wurdest in das §cTeam Rot §7geschoben!");
- }
- if(tb == tr) {
- Random r = new Random();
- int i = r.nextInt(2);
- if(i == 1) {
- TeamBlau.add(all);
- all.sendMessage(MainClass.prefix + "§7Du wurdest in das §9Team Blau §7geschoben!");
- } else
- if(i == 2) {
- TeamRot.add(all);
- all.sendMessage(MainClass.prefix + "§7Du wurdest in das §cTeam Rot §7geschoben!");
- }
- }
- }
- }
- for (Player teamblau : TeamBlau) {
- File mapfile = new File("plugins/NextPlugin/Maps", "maps.yml");
- FileConfiguration cfgmap = YamlConfiguration.loadConfiguration(mapfile);
- String world = cfgmap.getString("Warps." +ms+ ".Blau.World");
- double x = cfgmap.getDouble("Warps." +ms+ ".Blau.X");
- double y = cfgmap.getDouble("Warps." +ms+ ".Blau.Y");
- double z = cfgmap.getDouble("Warps." +ms+ ".Blau.Z");
- double yaw = cfgmap.getDouble("Warps." +ms+ ".Blau.Yaw");
- double pitch = cfgmap.getDouble("Warps." +ms+ ".Blau.Pitch");
- Location loc = new Location(Bukkit.getWorld(world), x, y, z);
- loc.setYaw((float)yaw);
- loc.setPitch((float)pitch);
- teamblau.teleport(loc);
- BountifulAPI.sendTitle(teamblau,20,10,10,"§e" +ms ,"§9Team Blau");
- teamblau.setBedSpawnLocation(loc);
- HasBlock.add(teamblau);
- }
- for (Player teamrot : TeamRot) {
- File mapfile = new File("plugins/NextPlugin/Maps", "maps.yml");
- FileConfiguration cfgmap = YamlConfiguration.loadConfiguration(mapfile);
- String world = cfgmap.getString("Warps." +ms+ ".Rot.World");
- double x = cfgmap.getDouble("Warps." +ms+ ".Rot.X");
- double y = cfgmap.getDouble("Warps." +ms+ ".Rot.Y");
- double z = cfgmap.getDouble("Warps." +ms+ ".Rot.Z");
- double yaw = cfgmap.getDouble("Warps." +ms+ ".Rot.Yaw");
- double pitch = cfgmap.getDouble("Warps." +ms+ ".Rot.Pitch");
- Location loc = new Location(Bukkit.getWorld(world), x, y, z);
- loc.setYaw((float)yaw);
- loc.setPitch((float)pitch);
- teamrot.teleport(loc);
- BountifulAPI.sendTitle(teamrot,20,10,10,"§e" +ms ,"§cTeam Rot");
- teamrot.setBedSpawnLocation(loc);
- HasBlock.add(teamrot);
- }
- }
- }
- }, 0, 20L);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement