Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.19 KB | None | 0 0
  1. public void createArenaSpawns(String filename, String worldName, int spawnNmb, Location loc, Player player){
  2.        
  3.         if(checkFiles(filename,worldName) == true){
  4.             if(spawnNmb <= getMaxPlayers(filename,worldName)){
  5.            
  6.                 File file = new File(plugin.getDataFolder() + File.separator + worldName, filename + ".yml");
  7.            
  8.                 config.set("maxPlayers", getMaxPlayers(filename,worldName));
  9.                 config.set("currentPlayers", getCurrentPlayers(filename, worldName));
  10.                 config.set("p" + spawnNmb + ".x", loc.getBlockX());
  11.                 config.set("p" + spawnNmb + ".y", loc.getBlockY());
  12.                 config.set("p" + spawnNmb + ".z", loc.getBlockZ());
  13.                 config.set("p" + spawnNmb + ".isTaken", false);
  14.            
  15.                 try {
  16.                     config.save(file);
  17.                     player.sendMessage(ChatColor.AQUA + "Successfully set spawn " + ChatColor.RED + "p" + spawnNmb + ChatColor.AQUA + " in arena " + ChatColor.RED + filename);
  18.                 } catch (IOException e) {
  19.                     e.printStackTrace();
  20.                 }
  21.             } else {
  22.                 player.sendMessage(ChatColor.RED + "Invalid Playerspawn-number. Its higher than the max supported Players.");
  23.                 return;
  24.             }
  25.         } else {   
  26.             player.sendMessage(ChatColor.RED + "That Arena does not exist.");
  27.             return;
  28.            
  29.         }
  30.        
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement