mojira.dev
MC-151857

The success message of `/give` when affecting multiple players uses the wrong string

When using the /give command and targeting multiple players, the string commands.give.success.multiple should be displayed. Instead, commands.give.success.single is displayed, with the first placeholder (playername) used by number of players who were given the item.

net.minecraft.server.commands.GiveCommand#giveItem

if (players.size() == 1) {
    source.sendSuccess(
        () - > Component.translatable(
            "commands.give.success.single", count, prototypeItemStack.getDisplayName(), ((ServerPlayer) players.iterator().next()).getDisplayName()
        ),
        true
    );
} else {
    // This one use the bad translate key
    source.sendSuccess(() - > Component.translatable("commands.give.success.single", count, prototypeItemStack.getDisplayName(), players.size()), true);
}

Linked issues

Comments 6

Can confirm for 1.17.1

Confirmed in 1.19.1

Can confirm in 1.19.3 and 23w06a

Confirmed in 26.1.2

Confirmed in 26.2-snapshot-3

Please edit your report to change the Affected Version to the version shown on the Minecraft title screen

Doc

boq

Confirmed

Commands

/give

Minecraft 17w45a, Minecraft 1.14.1, 19w42a, 20w17a, 1.17.1, , 26.2 Snapshot 8, 26.2 Pre-Release 1, 26.2 Pre-Release 3, 26.2 Pre-Release 4, 26.2 Pre-Release 5

26.3 Snapshot 1

Retrieved