PaperMC / PaperMC/Paper

kickPlayer does not take effect immediately

Open
#14,133 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: needs triage version: 26.2
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing Bukkit's kickPlayer and Bukkit.unloadWorld calls through the server tick lifecycle described in the report, focusing on when the player list is updated. Reproduce the same-tick shutdown sequence and verify that kicking players allows the world unload to succeed immediately without waiting for the end of the tick.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.