Solved Teleport player to another world?

Discussion in 'Spigot Plugin Development' started by UnlimitedNinjas, Jun 11, 2018.

  1. How do i teleport player to another world?
    And if he is already in the other world, send a message to the sender.?
    Ive researched this but couldn't find anything.
    Code (Text):
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String lable, String args[]) {
            if (sender instanceof Player) {
                Player p = (Player) sender;
                if (args.length == 0) {
                    p.sendMessage(ChatColor.RED + "Usage: /send <player> <world>");
                    return true;
                }
                Player target = Bukkit.getServer().getPlayer(args[0]);
                if (target == null) {
                    p.sendMessage(ChatColor.DARK_RED + "Player not found!");
                    return true;
                }
                if (args.length == 1) {
                    p.sendMessage(ChatColor.RED + "Usage /send <player> <world>");
                }
                if (args.length == 2) {
                 
                }
            }
            return true;
        }
     
    #1 UnlimitedNinjas, Jun 11, 2018
    Last edited: Jun 11, 2018
  2. Seriously.....

    Code (Text):
    Location location = new Location(World, x, y, z)
    player.teleport(location)
    Its literally that simple..
     
    • Winner Winner x 2
  3. how would i implements this?
     
  4. cuz i cant just put world x y z in there
     
  5. If you can't figure that out for yourself I'm not going to help you. This is super basic stuff and you should try learn the basics of the spigot api (try youtube) before asking questions.
     
  6. Variables are way before spigot api.
    @UnlimitedNinjas Perhaps try googling some crash-course java tutorials?