Advertisement
NiRoXz

respawn(); - ShulkerDefence

Mar 20th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public void respawn(final Player p) {
  2.        
  3.         Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  4.            
  5.             @Override
  6.             public void run() {
  7.                 PacketPlayInClientCommand packet = new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN);
  8.                 ((CraftPlayer)p).getHandle().playerConnection.a(packet);
  9.                
  10.                
  11.                 if(!HasBlock.contains(p)) {
  12.                     if(TeamBlau.size() == 0 && TeamRot.size() >= 1) {
  13.                         //Rot gewinnt
  14.                      
  15.                       File spawnfile = new File("plugins/NextPlugin/spawns", "spawn.yml");
  16.                       FileConfiguration cfgspawn = YamlConfiguration.loadConfiguration(spawnfile);
  17.                      
  18.                         String world1 = cfgspawn.getString("ServerSpawn.World");
  19.                         double x1 = cfgspawn.getDouble("ServerSpawn.X");
  20.                         double y1 = cfgspawn.getDouble("ServerSpawn.Y");
  21.                         double z1 = cfgspawn.getDouble("ServerSpawn.Z");
  22.                         double yaw1 = cfgspawn.getDouble("ServerSpawn.Yaw");
  23.                         double pitch1 = cfgspawn.getDouble("ServerSpawn.Pitch");
  24.                         Location loc1 = new Location(Bukkit.getWorld(world1), x1, y1, z1);
  25.                         loc1.setYaw((float)yaw1);
  26.                         loc1.setPitch((float)pitch1);
  27.                        
  28.                         for (Player all : Bukkit.getOnlinePlayers()) {
  29.                            
  30.                             all.teleport(loc1);
  31.                             all.sendMessage(prefix + "§aDas Spiel ist vorbei!");
  32.                            
  33.                             BountifulAPI.sendTitle(all,10,20*3,10,"§6Spielende!","§cTeam Rot §7gewinnt!");
  34.                             p.playSound(p.getLocation(), Sound.BLOCK_NOTE_PLING, 1, 1);
  35.                             startEnding(all);
  36.                         }
  37.                     }
  38.                    
  39.                     if(TeamRot.size() == 0 && TeamBlau.size() >= 1) {
  40.                         //Blau gewinnt
  41.                      
  42.                       File spawnfile = new File("plugins/NextPlugin/spawns", "spawn.yml");
  43.                       FileConfiguration cfgspawn = YamlConfiguration.loadConfiguration(spawnfile);
  44.                      
  45.                         String world1 = cfgspawn.getString("ServerSpawn.World");
  46.                         double x1 = cfgspawn.getDouble("ServerSpawn.X");
  47.                         double y1 = cfgspawn.getDouble("ServerSpawn.Y");
  48.                         double z1 = cfgspawn.getDouble("ServerSpawn.Z");
  49.                         double yaw1 = cfgspawn.getDouble("ServerSpawn.Yaw");
  50.                         double pitch1 = cfgspawn.getDouble("ServerSpawn.Pitch");
  51.                         Location loc1 = new Location(Bukkit.getWorld(world1), x1, y1, z1);
  52.                         loc1.setYaw((float)yaw1);
  53.                         loc1.setPitch((float)pitch1);
  54.  
  55.                         BountifulAPI.sendTitle(p,10,20*3,10,"§6Spielende!","§9Team Blau §7gewinnt!");
  56.                        
  57.                         for (Player all : Bukkit.getOnlinePlayers()) {
  58.                            
  59.                             all.teleport(loc1);
  60.                             all.sendMessage(prefix + "§aDas Spiel ist vorbei!");
  61.                            
  62.                             all.getInventory().clear();
  63.                             all.getActivePotionEffects().clear();
  64.                            
  65.                             BountifulAPI.sendTitle(all,10,20*3,10,"§6Spielende!","§9Team Blau §7gewinnt!");
  66.                             p.playSound(p.getLocation(), Sound.BLOCK_NOTE_PLING, 1, 1);
  67.  
  68.                             gs = GameState.ENDING;
  69.                            startEnding(all);
  70.                            
  71.                         }
  72.                     }
  73.                 } else {
  74.                     teleport(p);
  75.                 }
  76.             }
  77.         }, 40L);
  78.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement