Skip to content

Chat vs Console command arguments mismatch #5777

@molor

Description

@molor

Expected behavior

Player1 or Console performed command:

/tt 1 2  3   4    5     0

TestPlugin onCommand handler received:

arguments: ["1", "2", "3", "4", "5", "0"]

Observed/Actual behavior

Player1 performed command:

/tt 1 2  3   4    5     0

TestPlugin onCommand handler received:

arguments: ["1", "2", "3", "4", "5", "0"]

Console performed command:

/tt 1 2  3   4    5     0

TestPlugin onCommand handler received:

arguments: ["1", "2", "", "3", "", "", "4", "", "", "", "5", "", "", "", "", "0"]

Steps/models to reproduce

@Override
public boolean onCommand(CommandSender theSender, Command theCommand, String labelString, String[] arguments) {
	if (theCommand.getName().equalsIgnoreCase("tt")) {
		System.out.println("arguments: [\"" + String.join("\", \"", arguments) + "\"]");
		return true;
	}

	return false;
}

Then try to perform tt command with more than 1 space between arguments from game chat and server console and see the difference. This problem can break some plugins which do not expect to see empty strings as the argument value, because you can't send an empty argument from a game chat.

Plugin list

TestPlugin

Paper version

git-Paper-763 (MC: 1.16.5)

Agreements

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething doesn't work as it was intended to.version: 1.16Game version 1.16

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions