Skip to content

kickPlayer does not take effect immediately #14133

Description

@faosucvwabscvbw

Expected behavior

java
@OverRide
public void onDisable()
{
for (World world : Bukkit.getWorlds())
{
for (Player player : world.getPlayers())
{
player.kickPlayer("Server closed");
}
Bukkit.unloadWorld(world, false); //return true
}
}

Observed/Actual behavior

java
@OverRide
public void onDisable()
{
for (World world : Bukkit.getWorlds())
{
for (Player player : world.getPlayers())
{
player.kickPlayer("Server closed");
}
Bukkit.unloadWorld(world, false); //return false
}
}

Steps/models to reproduce

void

Plugin and Datapack List

void

Paper version

This server is running Paper version 26.2-84-main@26e81c4 (2026-07-26T18:11:33Z) (Implementing API version 26.2.build.84-stable)
You are 3 version(s) behind

Other

After kickPlayer is called, the player is not immediately removed from the player list within the same tick. As a result, the world cannot be directly unloaded within that same tick in the plugin. The player list update occurs at the end of the server tick, which is after Bukkit.unloadWorld is executed

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions