Minecraft:Commands/scoreboard: Difference between revisions
More actions
Fix template calls: add MC/ prefix |
Sync: updated from Minecraft |
||
| Line 4: | Line 4: | ||
* 2{{only|java|short=1}} | * 2{{only|java|short=1}} | ||
* 1{{only|bedrock|short=1}} | * 1{{only|bedrock|short=1}} | ||
|others=Cheat only{{only|bedrock|short=1}} | |others=[[Minecraft:Cheat]] only{{only|bedrock|short=1}} | ||
}} | }} | ||
Manages and displays scores for various scoreboard objectives. | Manages and displays scores for various [[Minecraft:scoreboard]] objectives. | ||
== Objectives commands == | == Objectives commands == | ||
=== Syntax === | === Syntax === | ||
: <code>scoreboard objectives '''list'''</code> | : <code>scoreboard objectives '''list'''</code> | ||
:: Lists all existing objectives with their display names and criteria. | :: Lists all existing [[Minecraft:Scoreboard#Objectives|objectives]] with their display names and criteria. | ||
: <code>scoreboard objectives '''add''' <objective> <criteria> [<displayName>]</code> ({{ | : <code>scoreboard objectives '''add''' <objective> <criteria> [<displayName>]</code> ({{el|java}}) | ||
: <code>scoreboard objectives '''add''' <objective: string> dummy [displayName: string]</code> ({{ | : <code>scoreboard objectives '''add''' <objective: string> dummy [displayName: string]</code> ({{el|bedrock}}) | ||
:: Creates a new objective with the given internal objective name, specified criterion, and the optional display name. | :: Creates a new objective with the given internal objective name, specified criterion, and the optional display name. | ||
: <code>scoreboard objectives '''remove''' <objective></code> ({{ | : <code>scoreboard objectives '''remove''' <objective></code> ({{el|java}}) | ||
: <code>scoreboard objectives '''remove''' <objective: string></code> ({{ | : <code>scoreboard objectives '''remove''' <objective: string></code> ({{el|bedrock}}) | ||
:: Deletes the named objective from the scoreboard system. Data is deleted from the objectives list and score holders' scores, and if it was on a display list it is no longer displayed. | :: Deletes the named objective from the scoreboard system. Data is deleted from the objectives list and score holders' scores, and if it was on a display list it is no longer displayed. | ||
: <code>scoreboard objectives '''setdisplay''' <slot> [<objective>]</code> ({{ | : <code>scoreboard objectives '''setdisplay''' <slot> [<objective>]</code> ({{el|java}}) | ||
: <code>scoreboard objectives '''setdisplay''' <list|sidebar> [objective: string] [ascending|descending]</code> ({{ | : <code>scoreboard objectives '''setdisplay''' <list|sidebar> [objective: string] [ascending|descending]</code> ({{el|bedrock}}) | ||
: <code>scoreboard objectives '''setdisplay''' belowname [objective: string]</code> ({{ | : <code>scoreboard objectives '''setdisplay''' belowname [objective: string]</code> ({{el|bedrock}}) | ||
:: Displays score info for the objective in the given slot. Note that the objective parameter is optional; if no objective is provided, this display slot is cleared (returned to its default state). {{ | :: Displays score info for the objective in the given slot. Note that the objective parameter is optional; if no objective is provided, this display slot is cleared (returned to its default state). {{IN|bedrock}}, if slot is <code>list</code> or <code>sidebar</code>, there is an additional optional argument <code>ascending|descending</code> to specify the sort order. | ||
: <code>scoreboard objectives '''modify''' <objective> '''displayautoupdate''' <value></code> ({{ | : <code>scoreboard objectives '''modify''' <objective> '''displayautoupdate''' <value></code> ({{el|java}}) | ||
:: Changes whether or not display names are automatically updated on every score update. | :: Changes whether or not display names are automatically updated on every score update. | ||
: <code>scoreboard objectives '''modify''' <objective> '''displayname''' <displayName></code> ({{ | : <code>scoreboard objectives '''modify''' <objective> '''displayname''' <displayName></code> ({{el|java}}) | ||
:: Changes the display name of the scoreboard in display slots. | :: Changes the display name of the scoreboard in display slots. | ||
: <code>scoreboard objectives '''modify''' <objective> '''numberformat'''</code> ({{ | : <code>scoreboard objectives '''modify''' <objective> '''numberformat'''</code> ({{el|java}}) | ||
:: Resets the default number format of the scoreboard in display slots and in score text components. | :: Resets the default number format of the scoreboard in display slots and in score text components. | ||
: <code>scoreboard objectives '''modify''' <objective> '''numberformat blank'''</code> ({{ | : <code>scoreboard objectives '''modify''' <objective> '''numberformat blank'''</code> ({{el|java}}) | ||
:: Sets the default number format to blank, which indicates that the score is not shown. | :: Sets the default number format to blank, which indicates that the score is not shown. | ||
: <code>scoreboard objectives '''modify''' <objective> '''numberformat fixed''' <component></code> ({{ | : <code>scoreboard objectives '''modify''' <objective> '''numberformat fixed''' <component></code> ({{el|java}}) | ||
:: Sets the default number format to fixed, which indicates that the score is replaced by the text component. | :: Sets the default number format to fixed, which indicates that the score is replaced by the text component. | ||
: <code>scoreboard objectives '''modify''' <objective> '''numberformat styled''' <style></code> ({{ | : <code>scoreboard objectives '''modify''' <objective> '''numberformat styled''' <style></code> ({{el|java}}) | ||
:: Sets the default number format to styled, which indicates that the score is displayed with the selected style. | :: Sets the default number format to styled, which indicates that the score is displayed with the selected style. | ||
: <code>scoreboard objectives '''modify''' <objective> '''rendertype''' (hearts<nowiki>|</nowiki>integer)</code> ({{ | : <code>scoreboard objectives '''modify''' <objective> '''rendertype''' (hearts<nowiki>|</nowiki>integer)</code> ({{el|java}}) | ||
:: Changes the display format for scores in the tab player list. | :: Changes the display format for scores in the tab player list. | ||
=== Arguments === | === Arguments === | ||
{{ | {{argument|objective|objective|objective: string|basic_string}} | ||
: Specifies the internal objective name. | : Specifies the internal objective name. | ||
: {{ | : {{arg desc|je=objective|be=basic_string}} | ||
{{ | {{argument|criteria|objective_criteria|dummy}} | ||
: Specifies the criterion of the new objective. | : Specifies the criterion of the new objective. | ||
: {{ | : {{arg desc|je=objective_criteria}} {{IN|bedrock}}, "dummy" is the only criterion currently supported | ||
{{ | {{argument|displayName|component|displayName: string|basic_string}} | ||
: Specifies the display name, defaulting to <code><objective></code> when unspecified. | : Specifies the display name, defaulting to <code><objective></code> when unspecified. | ||
: {{ | : {{IN|java}}, must be a [[Minecraft:raw JSON text]]. {{IN|bedrock}}, it must be either a single word that isn't a number (allowed characters: {{cd|-|:|.|_|delimiter=, }}, {{cd|A|Z|delimiter=-}}, {{cd|a|z|delimiter=-}}, and {{cd|0|9|delimiter=-}}) or a double-quoted string. | ||
{{ | {{argument|slot|scoreboard_slot|<nowiki>list|sidebar|belowname</nowiki>}} | ||
: Specifies the slot to display the objective. | : Specifies the slot to display the objective. | ||
: {{ | : {{arg desc|je=scoreboard_slot}} Valid slots are listed and described in [[Minecraft:Scoreboard#Display_slots|Display Slots]]. | ||
: {{ | : {{arg desc|je=objective|be=basic_string}} | ||
{{ | {{el|be|short=1}}: <code>ascending|descending</code> | ||
: Specifies the sort order. | : Specifies the sort order. | ||
{{ | {{el|je|short=1}}: {{argument|value|bool}} | ||
: Specifies whether display names are auto-updated. | : Specifies whether display names are auto-updated. | ||
: {{ | : {{arg desc|je=bool}} | ||
{{ | {{el|je|short=1}}: {{argument|displayName|component}} | ||
: Specifies the display name. | : Specifies the display name. | ||
: {{ | : {{arg desc|je=component}} | ||
{{ | {{el|je|short=1}}: {{argument|component|component}} | ||
: Specifies display text. | : Specifies display text. | ||
: {{ | : {{arg desc|je=component}} | ||
{{ | {{el|je|short=1}}: {{argument|style|style}} | ||
: Specifies the style. | : Specifies the style. | ||
: {{arg_desc|je=style}} | : {{arg_desc|je=style}} | ||
{{ | {{el|je|short=1}}: <code>hearts|integer</code> | ||
: Specifies the format. | : Specifies the format. | ||
| Line 90: | Line 90: | ||
=== Output === | === Output === | ||
{{ | {{Output table}} | ||
{{ | {{Output table|edition=je|cmd=... list|On success|1|1|the number of objectives in scoreboard system}} | ||
{{ | {{Output table|cmd=... add ...<br>... remove ...|On success|1|1|the number of objectives in scoreboard system after execution}} | ||
{{ | {{Output table|cmd=|On success|1|1|0}} | ||
{{ | {{Output table|edition=be|cmd=|On success|the number of objectives in scoreboard system}} | ||
{{ | {{Output table}} | ||
== Players commands == | == Players commands == | ||
=== Syntax === | === Syntax === | ||
: <code>scoreboard players '''list''' [<target>]</code> ({{ | : <code>scoreboard players '''list''' [<target>]</code> ({{el|java}}) | ||
: <code>scoreboard players '''list''' [playername: target]</code> ({{ | : <code>scoreboard players '''list''' [playername: target]</code> ({{el|bedrock}}) | ||
:: Lists all score holders that are tracked in some way by the scoreboard system. The optional <code><target></code> or <code>playername: target</code> parameter is used to list the scores of particular score holders. | :: Lists all [[Minecraft:Scoreboard#Objectives|score holders]] that are tracked in some way by the scoreboard system. The optional <code><target></code> or <code>playername: target</code> parameter is used to list the scores of particular score holders. | ||
: <code>scoreboard players '''get''' <target> <objective></code> ({{ | : <code>scoreboard players '''get''' <target> <objective></code> ({{el|java}}) | ||
:: Return the scoreboard value. Can be used in conjunction with the {{ | :: Return the scoreboard value. Can be used in conjunction with the {{cmd|execute}} command: {{cmd|execute store result ... run scoreboard players get ...}} | ||
: <code>scoreboard players '''set''' <targets> <objective> <score></code> ({{ | : <code>scoreboard players '''set''' <targets> <objective> <score></code> ({{el|java}}) | ||
:<code>scoreboard players '''set''' <player: target> <objective: string> <count: int></code> ({{ | :<code>scoreboard players '''set''' <player: target> <objective: string> <count: int></code> ({{el|bedrock}}) | ||
:: Set the targets' scores in the given objective, overwriting any previous score. | :: Set the targets' scores in the given objective, overwriting any previous score. | ||
: <code>scoreboard players '''add''' <targets> <objective> <score></code> ({{ | : <code>scoreboard players '''add''' <targets> <objective> <score></code> ({{el|java}}) | ||
: <code>scoreboard players '''add''' <player: target> <objective: string> <count: int></code> ({{ | : <code>scoreboard players '''add''' <player: target> <objective: string> <count: int></code> ({{el|bedrock}}) | ||
:: Increments the targets' scores in that objective by the given amount. {{ | :: Increments the targets' scores in that objective by the given amount. {{IN|bedrock}}, a negative count subtracts from the score. | ||
: <code>scoreboard players '''remove''' <targets> <objective> <score></code> ({{ | : <code>scoreboard players '''remove''' <targets> <objective> <score></code> ({{el|java}}) | ||
: <code>scoreboard players '''remove''' <player: target> <objective: string> <count: int></code> ({{ | : <code>scoreboard players '''remove''' <player: target> <objective: string> <count: int></code> ({{el|bedrock}}) | ||
:: Decrements the targets' scores in that objective by the given amount. {{ | :: Decrements the targets' scores in that objective by the given amount. {{IN|bedrock}}, a negative number adds to the score. | ||
: <code>scoreboard players '''random''' <player: target> <objective: string> <min: int> <max: int></code> ({{ | : <code>scoreboard players '''random''' <player: target> <objective: string> <min: int> <max: int></code> ({{el|bedrock}}) | ||
:: Sets the targets' scores in that objective to a random number between min and max (both inclusive). | :: Sets the targets' scores in that objective to a random number between min and max (both inclusive). | ||
: <code>scoreboard players '''reset''' <targets> [<objective>]</code> ({{ | : <code>scoreboard players '''reset''' <targets> [<objective>]</code> ({{el|java}}) | ||
: <code>scoreboard players '''reset''' <player: target> [objective: string]</code> ({{ | : <code>scoreboard players '''reset''' <player: target> [objective: string]</code> ({{el|bedrock}}) | ||
:: Deletes score or all scores for the targets. If <code><objective></code> is specified, then only that objective is cleared. Otherwise, this applies to all objectives. | :: Deletes score or all scores for the targets. If <code><objective></code> is specified, then only that objective is cleared. Otherwise, this applies to all objectives. | ||
:: Note that this does not merely set the scores to 0: it removes the targets from the scoreboard system (or for the given objective) altogether. | :: Note that this does not merely set the scores to 0: it removes the targets from the scoreboard system (or for the given objective) altogether. | ||
:: {{ | :: {{IN|java}}, this also disables the target players' ability to use {{cmd|trigger}} command (on the given objective if specified). | ||
:: {{ | :: {{IN|java}}, running <code>scoreboard players reset *</code> will reset the scores of all players, while <code>scoreboard players reset @a</code> will only reset the scores of players online. | ||
: <code>scoreboard players '''test''' <player: target> <objective: string> <min: wildcard int> [<max: wildcard int>]</code> ({{ | : <code>scoreboard players '''test''' <player: target> <objective: string> <min: wildcard int> [<max: wildcard int>]</code> ({{el|bedrock}}) | ||
:: Tests if targets' scores are between min and max (defaults to MAX_INT(2,147,483,647)). | :: Tests if targets' scores are between min and max (defaults to MAX_INT(2,147,483,647)). | ||
: <code>scoreboard players '''enable''' <targets> <objective></code> ({{ | : <code>scoreboard players '''enable''' <targets> <objective></code> ({{el|java}}) | ||
:: Enables the target(s) to use the {{ | :: Enables the target(s) to use the {{cmd|trigger}} command on the specified objective. This command accepts non-player entities, but only players are able to actually use the {{cmd|trigger}} command. Until this command has been run, players can't trigger that objective. Using the {{cmd|trigger}} command disables it again. | ||
:: Note that if any of the targets did not previously have a score for that scoreboard, this command sets their score to 0. | :: Note that if any of the targets did not previously have a score for that scoreboard, this command sets their score to 0. | ||
: <code>scoreboard players '''operation''' <targets> <targetObjective> <operation> <source> <sourceObjective></code> ({{ | : <code>scoreboard players '''operation''' <targets> <targetObjective> <operation> <source> <sourceObjective></code> ({{el|java}}) | ||
: <code>scoreboard players '''operation''' <player: target> <targetObjective: string> <operation: operator> <selector: target> <objective: string></code> ({{ | : <code>scoreboard players '''operation''' <player: target> <targetObjective: string> <operation: operator> <selector: target> <objective: string></code> ({{el|bedrock}}) | ||
:: Applies an arithmetic operation altering the targets' scores in the target objective, using sources' scores in the source objective as input. | :: Applies an arithmetic operation altering the targets' scores in the target objective, using sources' scores in the source objective as input. | ||
: <code>scoreboard players '''display name''' <targets> <objective></code> ({{ | : <code>scoreboard players '''display name''' <targets> <objective></code> ({{el|java}}) | ||
:: Resets the display name of the targets' scores. | :: Resets the display name of the targets' scores. | ||
: <code>scoreboard players '''display name''' <targets> <objective> <text></code> ({{ | : <code>scoreboard players '''display name''' <targets> <objective> <text></code> ({{el|java}}) | ||
:: Changes the display name of the targets' scores. | :: Changes the display name of the targets' scores. | ||
: <code>scoreboard players '''display numberformat''' <targets> <objective></code> ({{ | : <code>scoreboard players '''display numberformat''' <targets> <objective></code> ({{el|java}}) | ||
:: Resets the number format of the targets' scores. | :: Resets the number format of the targets' scores. | ||
: <code>scoreboard players '''display numberformat''' <targets> <objective> '''blank'''</code> ({{ | : <code>scoreboard players '''display numberformat''' <targets> <objective> '''blank'''</code> ({{el|java}}) | ||
:: Sets the number format of the targets' scores to blank, which indicates that the score is not shown. | :: Sets the number format of the targets' scores to blank, which indicates that the score is not shown. | ||
: <code>scoreboard players '''display numberformat''' <targets> <objective> '''fixed''' <contents></code> ({{ | : <code>scoreboard players '''display numberformat''' <targets> <objective> '''fixed''' <contents></code> ({{el|java}}) | ||
:: Sets the number format of the targets' scores to fixed, which indicates that the score is replaced by the text component. | :: Sets the number format of the targets' scores to fixed, which indicates that the score is replaced by the text component. | ||
: <code>scoreboard players '''display numberformat''' <targets> <objective> '''styled''' <style></code> ({{ | : <code>scoreboard players '''display numberformat''' <targets> <objective> '''styled''' <style></code> ({{el|java}}) | ||
:: Sets the number format of the targets' scores to styled, which indicates that the score is displayed with the selected style. | :: Sets the number format of the targets' scores to styled, which indicates that the score is displayed with the selected style. | ||
=== Arguments === | === Arguments === | ||
{{ | {{argument|target|score_holder|playername: target|WildcardCommandSelector<Actor>}} | ||
: Specifies the score holder. | : Specifies the score holder. | ||
: {{ | : {{arg desc|je=score_holder|be=WildcardCommandSelector<Actor>}} | ||
: {{ | : {{IN|java}}, only a single score holder can be specified, and <code>*</code> only works for <code>scoreboard players reset</code> ({{bug|MC-136858}}). {{IN|bedrock}}, multiple score holders can be specified. | ||
{{ | {{argument|targets|score_holder|player: target|WildcardCommandSelector<Actor>}} | ||
: Specifies the score holders. | : Specifies the score holders. | ||
: {{ | : {{arg desc|je=score_holder|be=WildcardCommandSelector<Actor>}} | ||
{{ | {{argument|objective|objective|objective: string|basic_string}} | ||
: Specifies the internal objective name. | : Specifies the internal objective name. | ||
: {{ | : {{arg desc|je=objective|be=basic_string}} | ||
{{ | {{argument|score|integer|count: int|int}} | ||
: Specifies the new score, an amount to add to the score, or an amount to subtract from the score. | : Specifies the new score, an amount to add to the score, or an amount to subtract from the score. | ||
: {{ | : {{arg desc|je=integer|be=int}} | ||
{{ | {{el|be|short=1}}: {{argument|min: int|int}}<br>{{el|be|short=1}}: {{argument|max: int|int}} | ||
: Specifies the min value and max value that the random number is between. | : Specifies the min value and max value that the random number is between. | ||
: {{ | : {{arg desc|be=int}} | ||
{{ | {{el|be|short=1}}: {{argument|min: wildcard int|CommandWildcardInt}}<br>{{el|be|short=1}}: {{argument|max: wildcard int|int}} | ||
: Specifies the min value and max value that the random number is between. | : Specifies the min value and max value that the random number is between. | ||
: Must be a 32-bit integer. And <code>min: wildcard int</code> can be replaced with asterisk (*) to represent -2,147,483,648, and <code>max: wildcard</code> int can be replaced with asterisk (*) to represent 2,147,483,647. | : Must be a 32-bit integer. And <code>min: wildcard int</code> can be replaced with asterisk (*) to represent -2,147,483,648, and <code>max: wildcard</code> int can be replaced with asterisk (*) to represent 2,147,483,647. | ||
{{ | {{argument|targetObjective|objective|targetObjective: string|basic_string}} | ||
: Specifies the objective for targets. | : Specifies the objective for targets. | ||
: {{ | : {{arg desc|je=objective|be=basic_string}} | ||
{{ | {{argument|source|score_holder|selector: target|WildcardCommandSelector<Actor>}} | ||
: Specifies the source score holders whose scores are used as source inputs. | : Specifies the source score holders whose scores are used as source inputs. | ||
: {{ | : {{arg desc|je=score_holder|be=WildcardCommandSelector<Actor>}} | ||
{{ | {{argument|sourceObjective|objective|objective: string|basic_string}} | ||
: Specifies the objective for sources. | : Specifies the objective for sources. | ||
: {{ | : {{arg desc|je=objective|be=basic_string}} | ||
{{ | {{argument|operation|operation|operation: operator|CommandOperator}} | ||
: Specifies the operation to be applied. | : Specifies the operation to be applied. | ||
: {{ | : {{arg desc|je=operation|be=CommandOperator}} | ||
:* <code>=</code> Assignment: Set target's score to source's score | :* <code>=</code> Assignment: Set target's score to source's score | ||
:* <code>+=</code> Addition: Add source's score to target's score | :* <code>+=</code> Addition: Add source's score to target's score | ||
| Line 189: | Line 189: | ||
:* <code>/=</code> Floor division: Divide target's score by source' scores, and the result is rounded down to an integer. | :* <code>/=</code> Floor division: Divide target's score by source' scores, and the result is rounded down to an integer. | ||
:* <code>%=</code> Modulus: Divide target's score by source's score, and use the positive remainder to set the target score | :* <code>%=</code> Modulus: Divide target's score by source's score, and use the positive remainder to set the target score | ||
:* {{ | :* {{cd|><}} Swapping: swaps target's score and source's score | ||
:* {{ | :* {{cd|<}} Choosing minimum: Set target's score to source's score only if source's score is less. | ||
:* {{ | :* {{cd|>}} Choosing maximum: Set target's score to source's score only if source's score is bigger. | ||
: In all cases except {{ | : In all cases except {{cd|><}}, source's score remains unchanged when performing the operation on a target. If target or source isn't tracked by the specified objective, it is set to 0. If more than one score holder is specified as sources, performs the operation once with each source's score. If more than one target score holder is specified, performs the operation for each target one by one. | ||
: For <code>/=</code> and <code>%=</code>, if source's score is 0, the command fails {{ | : For <code>/=</code> and <code>%=</code>, if source's score is 0, the command fails {{in|java}}, or succeeds but does not change target's score {{in|bedrock}}. | ||
{{ | {{el|je|short=1}}: {{argument|text|component}} | ||
: Specifies the display name. | : Specifies the display name. | ||
: {{ | : {{arg desc|je=component}} | ||
{{ | {{el|je|short=1}}: {{argument|contents|component}} | ||
: Specifies display text. | : Specifies display text. | ||
: {{ | : {{arg desc|je=component}} | ||
{{ | {{el|je|short=1}}: {{argument|style|style}} | ||
: Specifies the style. | : Specifies the style. | ||
: {{arg_desc|je=style}} | : {{arg_desc|je=style}} | ||
| Line 234: | Line 234: | ||
=== Output === | === Output === | ||
{{ | {{Output table}} | ||
{{ | {{Output table|edition=je|cmd=... list <targets>|On success|1|1|the number of tracking objectives of the specified score holder}} | ||
{{ | {{Output table|cmd=... get ...|On success|1|1|the score's value}} | ||
{{ | {{Output table|cmd=... set ...|On success|1|1|the number of targets multiplied by the specified score}} | ||
{{ | {{Output table|cmd=... add ...<br>... remove ...|On success|1|1|the sum of the objective's score value of each target after execution}} | ||
{{ | {{Output table|cmd=... reset ...|On success|1|1|the number of the targets}} | ||
{{ | {{Output table|cmd=... enable ...|On success|1|1|the number of the targets whose scores are newly enabled}} | ||
{{ | {{Output table|cmd=... operation ...|On success|1|1|the sum of the objective's score value of each target after the operation on it}} | ||
{{ | {{Output table|cmd=|On success|1|1|0}} | ||
{{ | {{Output table|edition=be|cmd=... list|On success|the number of score holders}} | ||
{{ | {{Output table|cmd=... list [playername: target]|On success|the total number of tracking objectives of each score holder}} | ||
{{ | {{Output table|cmd=... set ...<br>... add ...<br>... remove ...<br>... random ...|On success|1}} | ||
{{ | {{Output table|cmd=... reset ...|On success|the number of the targets that is tracked by the scoreboard (or the specified objective)}} | ||
{{ | {{Output table|cmd=... test ...|On success|the number of the specified score holders whose score is between min and max}} | ||
{{ | {{Output table|cmd=... operation ...|On success|1}} | ||
{{ | {{Output table}} | ||
== History == | == History == | ||
=== ''Java Edition'' === | === ''Java Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{ | |{{HistoryLine|java}} | ||
|{{HistoryLine||1.5|dev=13w04a|Added {{ | |{{HistoryLine||1.5|dev=13w04a|Added {{cmd|scoreboard|link=none}}.}} | ||
|{{HistoryLine||1.13|dev=17w45a|Split teams usage to {{ | |{{HistoryLine||1.13|dev=17w45a|Split teams usage to {{cmd|team}} and tags usage to {{cmd|tag}}. <code>/scoreboard players test</code> removed in favor of <code>/execute (if/unless) score</code>.}} | ||
|{{HistoryLine|||dev=pre7|Added {{ | |{{HistoryLine|||dev=pre7|Added {{cmd|scoreboard objectives modify <''objectiveName''> displayname <''displayName''>|link=none}}.}} | ||
|{{HistoryLine|||dev=pre8|Added {{ | |{{HistoryLine|||dev=pre8|Added {{cmd|scoreboard objectives modify <''objectiveName''> rendertype ''hearts''|link=none}}, which makes health bars display as hearts, like this: {{Healthbar|12}}. | ||
|Added {{ | |Added {{cmd|scoreboard objectives modify <objectiveName> rendertype ''integer''|link=none}}, which makes health bars display as yellow numbers. | ||
|Objective names are now text components, not raw strings.}} | |Objective names are now text components, not raw strings.}} | ||
|{{ | |{{HistoryLine||1.18|dev=21w37a|Removed length limits for scoreboards, score holders and team names.}} | ||
|{{ | |{{HistoryLine||1.20.2|dev=23w31a|Renamed the display slot argument <code>belowName</code> to <code>below_name</code>.}} | ||
|{{ | |{{HistoryLine||1.20.3|dev=23w46a|Added new subcommands for changing the display of specific scoreboard entries in the sidebar.}} | ||
|{{HistoryLine||1.21.5|dev=25w02a|Text style in the {{ | |{{HistoryLine||1.21.5|dev=25w02a|Text style in the {{cmd|scoreboard}} command when specifying the styled number format is now specified with SNBT instead of JSON.}} | ||
|{{HistoryLine|||dev=25w05a|Text component arguments are now resolved before use in context of entity held in {{ | |{{HistoryLine|||dev=25w05a|Text component arguments are now resolved before use in context of entity held in {{cd|@s}}.}} | ||
}} | }} | ||
=== ''Bedrock Edition'' === | === ''Bedrock Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{ | |{{HistoryLine|bedrock}} | ||
|{{HistoryLine||1.7.0|dev=beta 1.7.0.2|Added {{ | |{{HistoryLine||1.7.0|dev=beta 1.7.0.2|Added {{cmd|scoreboard|link=none}}.}} | ||
}} | }} | ||
== See also == | == See also == | ||
*{{ | *{{cmd|team}} | ||
*{{ | *{{cmd|tag}} | ||
*{{ | *{{cmd|random}} | ||
== External links == | == External links == | ||
| Line 284: | Line 284: | ||
== Navigation == | == Navigation == | ||
{{ | {{Navbox commands}} | ||
de:Befehl/scoreboard | [[Minecraft:de:Befehl/scoreboard]] | ||
es:Comandos/scoreboard | [[Minecraft:es:Comandos/scoreboard]] | ||
ja:コマンド/scoreboard | [[Minecraft:fr:Commandes/scoreboard]] | ||
pt:Comandos/scoreboard | [[Minecraft:ja:コマンド/scoreboard]] | ||
ru:Команды консоли/scoreboard | [[Minecraft:pt:Comandos/scoreboard]] | ||
uk:Команди консолі/scoreboard | [[Minecraft:ru:Команды консоли/scoreboard]] | ||
zh:命令/scoreboard | [[Minecraft:uk:Команди консолі/scoreboard]] | ||
[[Minecraft:zh:命令/scoreboard]] | |||
Latest revision as of 11:06, 21 May 2026
Manages and displays scores for various Minecraft:scoreboard objectives.
Objectives commands
Syntax
scoreboard objectives list- Lists all existing objectives with their display names and criteria.
scoreboard objectives add <objective> <criteria> [<displayName>](Template:El)scoreboard objectives add <objective: string> dummy [displayName: string](Template:El)- Creates a new objective with the given internal objective name, specified criterion, and the optional display name.
scoreboard objectives remove <objective>(Template:El)scoreboard objectives remove <objective: string>(Template:El)- Deletes the named objective from the scoreboard system. Data is deleted from the objectives list and score holders' scores, and if it was on a display list it is no longer displayed.
scoreboard objectives setdisplay <slot> [<objective>](Template:El)scoreboard objectives setdisplay <list|sidebar> [objective: string] [ascending|descending](Template:El)scoreboard objectives setdisplay belowname [objective: string](Template:El)- Displays score info for the objective in the given slot. Note that the objective parameter is optional; if no objective is provided, this display slot is cleared (returned to its default state). Template:IN, if slot is
listorsidebar, there is an additional optional argumentascending|descendingto specify the sort order.
- Displays score info for the objective in the given slot. Note that the objective parameter is optional; if no objective is provided, this display slot is cleared (returned to its default state). Template:IN, if slot is
scoreboard objectives modify <objective> displayautoupdate <value>(Template:El)- Changes whether or not display names are automatically updated on every score update.
scoreboard objectives modify <objective> displayname <displayName>(Template:El)- Changes the display name of the scoreboard in display slots.
scoreboard objectives modify <objective> numberformat(Template:El)- Resets the default number format of the scoreboard in display slots and in score text components.
scoreboard objectives modify <objective> numberformat blank(Template:El)- Sets the default number format to blank, which indicates that the score is not shown.
scoreboard objectives modify <objective> numberformat fixed <component>(Template:El)- Sets the default number format to fixed, which indicates that the score is replaced by the text component.
scoreboard objectives modify <objective> numberformat styled <style>(Template:El)- Sets the default number format to styled, which indicates that the score is displayed with the selected style.
scoreboard objectives modify <objective> rendertype (hearts|integer)(Template:El)- Changes the display format for scores in the tab player list.
Arguments
- Specifies the internal objective name.
- Template:Arg desc
- Specifies the criterion of the new objective.
- Template:Arg desc Template:IN, "dummy" is the only criterion currently supported
- Specifies the display name, defaulting to
<objective>when unspecified. - Template:IN, must be a Minecraft:raw JSON text. Template:IN, it must be either a single word that isn't a number (allowed characters: Template:Cd, Template:Cd, Template:Cd, and Template:Cd) or a double-quoted string.
- Specifies the slot to display the objective.
- Template:Arg desc Valid slots are listed and described in Display Slots.
- Template:Arg desc
Template:El: ascending|descending
- Specifies the sort order.
Template:El: Template:Argument
- Specifies whether display names are auto-updated.
- Template:Arg desc
Template:El: Template:Argument
- Specifies the display name.
- Template:Arg desc
Template:El: Template:Argument
- Specifies display text.
- Template:Arg desc
Template:El: Template:Argument
- Specifies the style.
- Template:Arg desc
Template:El: hearts|integer
- Specifies the format.
Result
Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table
Output
Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table
Players commands
Syntax
scoreboard players list [<target>](Template:El)scoreboard players list [playername: target](Template:El)- Lists all score holders that are tracked in some way by the scoreboard system. The optional
<target>orplayername: targetparameter is used to list the scores of particular score holders.
- Lists all score holders that are tracked in some way by the scoreboard system. The optional
scoreboard players get <target> <objective>(Template:El)- Return the scoreboard value. Can be used in conjunction with the Template:Cmd command: Template:Cmd
scoreboard players set <targets> <objective> <score>(Template:El)scoreboard players set <player: target> <objective: string> <count: int>(Template:El)- Set the targets' scores in the given objective, overwriting any previous score.
scoreboard players add <targets> <objective> <score>(Template:El)scoreboard players add <player: target> <objective: string> <count: int>(Template:El)- Increments the targets' scores in that objective by the given amount. Template:IN, a negative count subtracts from the score.
scoreboard players remove <targets> <objective> <score>(Template:El)scoreboard players remove <player: target> <objective: string> <count: int>(Template:El)- Decrements the targets' scores in that objective by the given amount. Template:IN, a negative number adds to the score.
scoreboard players random <player: target> <objective: string> <min: int> <max: int>(Template:El)- Sets the targets' scores in that objective to a random number between min and max (both inclusive).
scoreboard players reset <targets> [<objective>](Template:El)scoreboard players reset <player: target> [objective: string](Template:El)- Deletes score or all scores for the targets. If
<objective>is specified, then only that objective is cleared. Otherwise, this applies to all objectives. - Note that this does not merely set the scores to 0: it removes the targets from the scoreboard system (or for the given objective) altogether.
- Template:IN, this also disables the target players' ability to use Template:Cmd command (on the given objective if specified).
- Template:IN, running
scoreboard players reset *will reset the scores of all players, whilescoreboard players reset @awill only reset the scores of players online.
- Deletes score or all scores for the targets. If
scoreboard players test <player: target> <objective: string> <min: wildcard int> [<max: wildcard int>](Template:El)- Tests if targets' scores are between min and max (defaults to MAX_INT(2,147,483,647)).
scoreboard players enable <targets> <objective>(Template:El)- Enables the target(s) to use the Template:Cmd command on the specified objective. This command accepts non-player entities, but only players are able to actually use the Template:Cmd command. Until this command has been run, players can't trigger that objective. Using the Template:Cmd command disables it again.
- Note that if any of the targets did not previously have a score for that scoreboard, this command sets their score to 0.
scoreboard players operation <targets> <targetObjective> <operation> <source> <sourceObjective>(Template:El)scoreboard players operation <player: target> <targetObjective: string> <operation: operator> <selector: target> <objective: string>(Template:El)- Applies an arithmetic operation altering the targets' scores in the target objective, using sources' scores in the source objective as input.
scoreboard players display name <targets> <objective>(Template:El)- Resets the display name of the targets' scores.
scoreboard players display name <targets> <objective> <text>(Template:El)- Changes the display name of the targets' scores.
scoreboard players display numberformat <targets> <objective>(Template:El)- Resets the number format of the targets' scores.
scoreboard players display numberformat <targets> <objective> blank(Template:El)- Sets the number format of the targets' scores to blank, which indicates that the score is not shown.
scoreboard players display numberformat <targets> <objective> fixed <contents>(Template:El)- Sets the number format of the targets' scores to fixed, which indicates that the score is replaced by the text component.
scoreboard players display numberformat <targets> <objective> styled <style>(Template:El)- Sets the number format of the targets' scores to styled, which indicates that the score is displayed with the selected style.
Arguments
- Specifies the score holder.
- Template:Arg desc
- Template:IN, only a single score holder can be specified, and
*only works forscoreboard players reset(Template:Bug). Template:IN, multiple score holders can be specified.
- Specifies the score holders.
- Template:Arg desc
- Specifies the internal objective name.
- Template:Arg desc
- Specifies the new score, an amount to add to the score, or an amount to subtract from the score.
- Template:Arg desc
Template:El: Template:Argument
Template:El: Template:Argument
- Specifies the min value and max value that the random number is between.
- Template:Arg desc
Template:El: Template:Argument
Template:El: Template:Argument
- Specifies the min value and max value that the random number is between.
- Must be a 32-bit integer. And
min: wildcard intcan be replaced with asterisk (*) to represent -2,147,483,648, andmax: wildcardint can be replaced with asterisk (*) to represent 2,147,483,647.
- Specifies the objective for targets.
- Template:Arg desc
- Specifies the source score holders whose scores are used as source inputs.
- Template:Arg desc
- Specifies the objective for sources.
- Template:Arg desc
- Specifies the operation to be applied.
- Template:Arg desc
=Assignment: Set target's score to source's score+=Addition: Add source's score to target's score-=Subtraction: Subtract source's score from target's score*=Multiplication: Set target's score to the product of the target's and source's scores/=Floor division: Divide target's score by source' scores, and the result is rounded down to an integer.%=Modulus: Divide target's score by source's score, and use the positive remainder to set the target score- Template:Cd Swapping: swaps target's score and source's score
- Template:Cd Choosing minimum: Set target's score to source's score only if source's score is less.
- Template:Cd Choosing maximum: Set target's score to source's score only if source's score is bigger.
- In all cases except Template:Cd, source's score remains unchanged when performing the operation on a target. If target or source isn't tracked by the specified objective, it is set to 0. If more than one score holder is specified as sources, performs the operation once with each source's score. If more than one target score holder is specified, performs the operation for each target one by one.
- For
/=and%=, if source's score is 0, the command fails Template:In, or succeeds but does not change target's score Template:In.
Template:El: Template:Argument
- Specifies the display name.
- Template:Arg desc
Template:El: Template:Argument
- Specifies display text.
- Template:Arg desc
Template:El: Template:Argument
- Specifies the style.
- Template:Arg desc
Result
Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table
Output
Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table
History
Java Edition
Bedrock Edition
See also
External links
Minecraft:de:Befehl/scoreboard Minecraft:es:Comandos/scoreboard Minecraft:fr:Commandes/scoreboard Minecraft:ja:コマンド/scoreboard Minecraft:pt:Comandos/scoreboard Minecraft:ru:Команды консоли/scoreboard Minecraft:uk:Команди консолі/scoreboard Minecraft:zh:命令/scoreboard