Getting a spawn point of a world and then setting the players position to there?

Discussion in 'Plugin Development' started by Callum.K, Jan 3, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Callum.K

    How come spawnPoint won't work in it's current place?
    Code:java
    1. if(cmd.getName().equalsIgnoreCase("goto"))
    2. {
    3. if(args.length == 1)
    4. {
    5. if(Bukkit.getWorld(args[0]) != null)
    6. {
    7. Location spawnPoint = Bukkit.getWorld(args[0]).getSpawnLocation();
    8. player.teleport(new Location(Bukkit.getWorld(args[0]), spawnPoint));
    9. }
    10. else player.sendMessage(ChatColor.GRAY + "Error: " + ChatColor.WHITE + "Invaild world name]");
    11. }
    12. else player.sendMessage(ChatColor.GRAY + "Error: " + ChatColor.WHITE + "/goto [world name]");
    13. return false;
    14. }
     
  2. Offline

    valon750

    Callum.K

    when teleporting a player, you simply do player.teleport(spawnPoint);
     
Thread Status:
Not open for further replies.

Share This Page