Minecraft 1.21 setlocation world

Discussion in 'Plugin Development' started by Kleinz1971, Jul 3, 2024.

  1. Offline


    Hi all . in older Minecraft this works fine :
    package commandplugin.commandplugin.commands;
    import commandplugin.commandplugin.CommandPlugin;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Location;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.configuration.file.FileConfiguration;
    import org.bukkit.entity.Player;
    import static org.bukkit.Bukkit.getServer;
    public class ExperimentalCommands implements CommandExecutor {
        public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
             //code area exp
            if (!(sender instanceof Player)) {
                sender.sendMessage(ChatColor.RED + "Du musst ein Spieler sein!!");
                return false;
            }//SpielerAbfrage ende
            Player player = (Player) sender;
            if (args.length == 1) {
                if (args[0].equalsIgnoreCase("tele")) {
                    player.sendMessage(ChatColor.GREEN + player.getName() + " Festhalten es geht los.");
                    String testworld = "NeueWelt";
                    double x1 = 200;
                    double y1 = 200;
                    double z1 = 200;
                    Location location = new Location(Bukkit.getWorld(testworld), x1, y1, z1);
                    ((Player) sender).teleport(location);
            return false;
    In Minecraft 1.21 it works only in actual loadet world . jump into other world ist make internal error.
    Example in server.properties word is: NeueWelt in this world i can jump to all homes .jump to home in other world make error. Change properties to other world .so i can user the homes from this world but not the homes from NeueWelt. How can i fix this? Thanks all. The homes i load from mysql table
  2. Offline

    timtower Administrator Administrator Moderator

Share This Page