Creating a new world stops the server responses for some time

Discussion in 'Plugin Development' started by Lokilife, Jul 6, 2021.

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

    Lokilife

    When I create a new world using WorldCreator, the server stops responding for at least 35 seconds and because of this, all the players on the server kick. And also, a thread dump is output to the console several times in a row, the last output contains information about the chunks of the generated world. If necessary, I will publish the log.
    My code:
    Player player = (Player) sender;

    World world = plugin.getServer().getWorld("KINGDOMS");
    if (world == null) {
    WorldCreator wc = new WorldCreator("KINGDOMS");
    wc.environment(World.Environment.NORMAL);
    wc.type(WorldType.NORMAL);
    System.out.println("Starting generation of new world,");
    world = wc.createWorld();
    System.out.println("Generation ended.");
    }
    System.out.println("Teleportation");
    player.teleport(world.getSpawnLocation());
    System.out.println("Teleportation Ended");

    player.sendTitle("Hi", "Welcome to the new world!", 3, 5000, 3);

    return true;

    EDITED: I forgot to say, PaperMC is used, although I tried it with a regular Spigot, which has about the same result.

    Solved. The problem was a small amount of RAM, allocating 3 gigabytes it worked fine.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 7, 2021
Thread Status:
Not open for further replies.

Share This Page