Skip to content

NullCommandSender in onCommand if command block output is disabled #13268

@molor

Description

@molor

Expected behavior

An instance of BlockCommandSender, because I want to get the command sender (command block) name & location in the world.

Observed/Actual behavior

NullCommandSender, that returns "" from getName and cannot be cast to BlockCommandSender to get a location.

But if I enable the command output, then BlockCommandSender is returned as before.

Steps/models to reproduce

  1. Place an impulse command block in the world, type test command from test plugin and disable the output.
  2. Power on the command block via button, lever or anything other.
  3. Meet the NullCommandSender, that isn't exposed in the API.

Plugin and Datapack List

Only a test plugin w/ test command:

@Override
public boolean onCommand(CommandSender theSender, Command theCommand, String theCNS, String[] vAA) {
	System.out.println("CommandSender: " + theSender.getClass());
}

Paper version

> version
This server is running Paper version 1.21.10-100-main@e8c6ba5 (2025-11-01T22:04:43Z) (Implementing API version 1.21.10-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.8-60-29c8822 (MC: 1.21.8)

Other

Before, in 1.21.8, BlockCommandSender was returned in all cases, and everything worked w/o issues.
I think this is a breaking change, and I don't remember it being reported in change logs...

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedDisputed bug is accepted as valid or Feature accepted as desired to be added.version: 1.21.10Game version 1.21.10

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions