Commands/give

Gives an item to a player.

Syntax

 * Java Edition


 * Bedrock Edition

Arguments

 * player (BE: player: target)
 * Specifies the target to give item(s) to. Must be a player name or target selector.


 * item (BE: itemName: Item)
 * Specifies the item to give. Must be a valid item id (for example, ), or block id for which items exist. Numerical ids are unsupported.


 * count (BE: amount: int) (optional)
 * Specifies the number of items to give. Must be between 1 and 64 (inclusive), but can be 64 even when that's more than one stack. If not specified, defaults to.


 * Item-specific stacking restrictions are not ignored, for example: will give the player 5 stacks of 1 sword each.


 * data: int (optional)
 * Specifies the item data of the given item(s). Must be an integer between -2,147,483,648 and 2,147,483,647 (inclusive, without the commas), but values which are invalid for the specified item id revert to 0. If not specified, defaults to 0.


 * components: json (optional)
 * Like DataTags but only supports   and   functions (for example, )

Result

 * Fails if the arguments are not specified correctly, or if player fails to resolve to one or more online players.


 * On success, summons the specified item(s) at the location(s) of the target(s). If player resolves to multiple targets, each receives the specified number of items. If there is room in the player's inventory, or the player is in creative mode, the item entity summoned is "fake", with its PickupDelay tag set to 32767 and its Age tag set to 5999, which would normally make it impossible to pick up the item, and have it despawn within a tick. If the player's inventory is full and they are not in creative mode, the item entity's Owner tag is set to the target and its PickupDelay tag set to 0 so that it can only be picked up by that player until within 10 seconds of it despawning, at which time other players may pick it up.

Examples

 * To give the nearest player a diamond sword with Lore that says "A legendary weapon":


 * To give all players a potion which has the Night Vision effect:


 * To give a random player a Sharpness X diamond sword:


 * To give Steve a block of diamond that can be placed on dirt and can break quartz blocks even in adventure mode.

History
NOTE: some things will not work in later updates