Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void respawn(final Player p) {
- Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
- @Override
- public void run() {
- PacketPlayInClientCommand packet = new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN);
- ((CraftPlayer)p).getHandle().playerConnection.a(packet);
- if(!HasBlock.contains(p)) {
- if(TeamBlau.size() == 0 && TeamRot.size() >= 1) {
- //Rot gewinnt
- File spawnfile = new File("plugins/NextPlugin/spawns", "spawn.yml");
- FileConfiguration cfgspawn = YamlConfiguration.loadConfiguration(spawnfile);
- String world1 = cfgspawn.getString("ServerSpawn.World");
- double x1 = cfgspawn.getDouble("ServerSpawn.X");
- double y1 = cfgspawn.getDouble("ServerSpawn.Y");
- double z1 = cfgspawn.getDouble("ServerSpawn.Z");
- double yaw1 = cfgspawn.getDouble("ServerSpawn.Yaw");
- double pitch1 = cfgspawn.getDouble("ServerSpawn.Pitch");
- Location loc1 = new Location(Bukkit.getWorld(world1), x1, y1, z1);
- loc1.setYaw((float)yaw1);
- loc1.setPitch((float)pitch1);
- for (Player all : Bukkit.getOnlinePlayers()) {
- all.teleport(loc1);
- all.sendMessage(prefix + "§aDas Spiel ist vorbei!");
- BountifulAPI.sendTitle(all,10,20*3,10,"§6Spielende!","§cTeam Rot §7gewinnt!");
- p.playSound(p.getLocation(), Sound.BLOCK_NOTE_PLING, 1, 1);
- startEnding(all);
- }
- }
- if(TeamRot.size() == 0 && TeamBlau.size() >= 1) {
- //Blau gewinnt
- File spawnfile = new File("plugins/NextPlugin/spawns", "spawn.yml");
- FileConfiguration cfgspawn = YamlConfiguration.loadConfiguration(spawnfile);
- String world1 = cfgspawn.getString("ServerSpawn.World");
- double x1 = cfgspawn.getDouble("ServerSpawn.X");
- double y1 = cfgspawn.getDouble("ServerSpawn.Y");
- double z1 = cfgspawn.getDouble("ServerSpawn.Z");
- double yaw1 = cfgspawn.getDouble("ServerSpawn.Yaw");
- double pitch1 = cfgspawn.getDouble("ServerSpawn.Pitch");
- Location loc1 = new Location(Bukkit.getWorld(world1), x1, y1, z1);
- loc1.setYaw((float)yaw1);
- loc1.setPitch((float)pitch1);
- BountifulAPI.sendTitle(p,10,20*3,10,"§6Spielende!","§9Team Blau §7gewinnt!");
- for (Player all : Bukkit.getOnlinePlayers()) {
- all.teleport(loc1);
- all.sendMessage(prefix + "§aDas Spiel ist vorbei!");
- all.getInventory().clear();
- all.getActivePotionEffects().clear();
- BountifulAPI.sendTitle(all,10,20*3,10,"§6Spielende!","§9Team Blau §7gewinnt!");
- p.playSound(p.getLocation(), Sound.BLOCK_NOTE_PLING, 1, 1);
- gs = GameState.ENDING;
- startEnding(all);
- }
- }
- } else {
- teleport(p);
- }
- }
- }, 40L);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement