コマンド (Command) は、Java Edition および Pocket Edition に存在する、定められた構文に従って書かれた高度な機能を持つテキストである。
使用法
通常の Minecraft のクライアントでは、T キーを押すか直接 / キーを入力してチャット画面を開いて入力する。/ キーを使ってチャット画面を開いた場合は、コマンドの先頭のスラッシュが最初から入力された状態でチャット画面が開く。↑ と ↓ キーを使用して、以前に実行したコマンドを入力できる。コマンドを入力中に Tab ↹ キーを押すと、使用可能なコマンドや引数、見ているブロックの座標が表示され、そのまま使用できる。
コマンドはサーバーのコンソールで使用することもできるが、その場合はコマンドには / は不要である。この方法でサーバー管理者がコマンドを実行することを「Ghosting」と呼ぶ。
コマンドブロックから実行されるコマンドにスラッシュ記号をつけてもよいが、必須ではない。また、コマンドブロック内のコマンドは追加でオプションの変数を記述する必要がある場合がある。その変数には、一般的にはプレイヤー名などが当てはまる。
大多数のコマンドは、以下の状況でのみ有効である
- マルチプレイサーバーにて、管理者またはコマンドブロックによって実行された場合
- その他のマルチプレイでは、「LAN に開く」からチートを有効にしてローカルマルチプレイを開始した場合、または自分でサーバーをホスティングしている場合
- シングルプレイで、ワールド生成時にチートを有効にした場合(「その他のワールドオプション」ボタンから設定する)
いくつかのコマンドは、シングルプレイにおいてチートが有効でなくとも実行できる。
注意:シングルプレイでワールドを作成時にチートを有効にしなかった場合でも、ローカルマルチプレイを開始する際にチートを有効にするとコマンドが使えるようになる(Esc → 「LAN に開く」 → 「チートを許可する:オン」)。この際他のプレイヤーがゲームに参加する必要はない。ワールドを出るとコマンドは使えなくなるが、コマンドを使ってワールドに加えた変更はそのまま保持される。ワールドに入る度に同じ手順を繰り返せばよい。ローカルマルチプレイを開始するとゲームを一時停止できなくなるので注意。ワールドから出ればローカルマルチプレイは終了される。
チルダ表記法
多数のコマンドではチルダの ~
記号で「相対座標」を使うことができる。チルダ記号と一緒に書かれた数字は、コマンドで指定した座標からの「オフセット」であり、+- の符号で正負の方向を指定する。~
一文字で ~0
を表す。
例えば、 tp 0 64 0
というコマンドではプレイヤーを x:0、y:64、z:0 の位置へテレポートするが、tp ~3 ~ ~-3
というコマンドではプレイヤーをX方向へ「+3」(つまり東へ3ブロック分)、高さはそのまま、そしてZ方向へ「-3」(つまり北へ3ブロック分)テレポートさせる。
絶対座標は相対座標と一緒に使うことが出来る。例えば、tp ~ 64 ~
は X 座標と Z 座標はそのままに、Y 座標:64 へテレポートさせるコマンドである。
相対座標の原点はそれぞれのコマンドに依存する。例えば /tp
コマンドの原点はテレポート開始時の座標である。その他のコマンドでは、原点はコマンドが実行された座標、またはコマンドで特別に指定した座標である。
ターゲットセレクター
大多数のコマンドでは、プレイヤー名でプレイヤーを指定する代わりに、条件を満たす一人もしくはそれ以上のプレイヤーを指定できる。条件でプレイヤーを指定する場合は、「ターゲットセレクター」の種類を選び、必要に応じて、満たされるべき条件を引数として追加できる。
例えば以下のコマンドでは、「Red」チームに所属する全てのプレイヤーのゲームモードをクリエイティブモードに変更する。各プレイヤー名を個別に指定するより効率的である: /gamemode creative @a[team=Red]
ターゲットセレクターの種類
変数 | 働き |
---|---|
@p |
最寄りのプレイヤー1人 |
@r |
ランダムなプレイヤー |
@a |
全てのプレイヤー |
@e |
全てのエンティティ |
@s |
コマンドを実行しているエンティティ |
ターゲットセレクターの種類によって幅広い対象を識別する。変数は4種類ある:
@p
- 最も近い一人のプレイヤーが対象になる。 もしも複数のプレイヤーが正確に同じ距離に存在した場合は、サーバーに最近参加したプレイヤーが優先して選ばれる。
- ターゲットセレクターの引数を使って、対象となるプレイヤーをさらに絞り込める。例えば
@p[team=Red]
とすれば最も近い「Red」チームのプレイヤーを対象にする。さらに近くにプレイヤーが居たとしても、チームが違うならば対象にならない。
- 引数
c
を使えば、対象になるプレイヤーの人数を増やすことが出来る(例えば@p[c=3]
なら最寄りの3人のプレイヤーが対象になる)。c
にマイナスの値を設定した場合は、対象を選ぶ優先順位が逆になる(例えば、@p[c=-1]
だと最も遠いプレイヤーを対象にする)。
@r
- ランダムなプレイヤーを対象にする(
type
引数を使えばランダムなエンティティも対象になる)。
- ターゲットセレクターの引数を使って、対象となるプレイヤーを絞り込むことが出来る。 例えば、
@r[team=Red]
は「Red」チームのプレイヤーの中からランダムで一人を対象にする。
c
引数を使えば対象になるプレイヤーの人数を増やせる。例えば、@r[c=3]
はランダムに3人のプレイヤーを対象にする。
type
引数を使わない場合は、@r
は常時プレイヤーを対象とする。type
引数を使えばプレイヤー以外のエンティティを対象にできる(例えば、@r[type=zombie]
はランダムなゾンビを対象にする。@r[type=!player]
はプレイヤー以外のエンティティをランダムで対象にする。@r[type=!zombie]
はゾンビ以外からランダムで対象にする)。
@a
- 死んだプレイヤーも含めて、全てのプレイヤーを対象にする。これ以外に死んだプレイヤーを対象にするセレクターはない。
- ターゲットセレクターの引数を使って、対象にするプレイヤーを絞り込むことができる。例えば、
@a[team=Red]
は「Red」チーム内の全プレイヤーを対象にする。
@e
- 全てのエンティティを対象にする(プレイヤーも含める)。
- ターゲットセレクターの引数を使って、対象にするエンティティを絞り込むことが出来る。 例えば、
@e[type=cow]
はウシだけを対象にする。
@s
- 1つのエンティティのみを対象とする(死亡したプレイヤーを含む、コマンドを実行したエンティティ)。実行者がエンティティでない場合、例えば実行者がコマンドブロックまたはサーバーコンソールであった場合、このセレクターは何も機能しない。
- ターゲットセレクターの引数を使って、対象となるプレイヤーをさらに絞り込める。例えば、
@s[type=cow,team=Red]
は実行者が「Red」チームのウシだった場合、コマンドの実行者を対象にする。
ターゲットセレクターの引数
ポジションによる選択 | |
---|---|
引数 | 選択基準 |
x , y , z |
座標 |
r , rm |
半径(最大、最小) |
dx , dy , dz |
範囲の大きさ |
スコアボード値による選択 | |
引数 | 選択基準 |
score_name |
最大スコア |
score_name_min |
最小スコア |
tag |
スコアボードのタグ |
team |
チーム名 |
特徴による選択 | |
引数 | 選択基準 |
c |
数 |
l , lm |
経験値レベル(最大、最小) |
m |
ゲームモード |
name |
エンティティ名 |
rx , rxm |
X 軸を中心とした向き(最大、最小) |
ry , rym |
Y 軸を中心とした向き (最大、最小) |
type |
エンティティの種類 |
ターゲットセレクターの後に引数を追記することで、選択基準をさらに編集することが出来る。 @a
または @e
セレクターと一緒に使えば、全ての中から特定の限られた対象に絞り込むことが出来る。@p
または @r
セレクターと一緒に使えば、最寄りのまたはランダムに選ばれた対象の中からさらに絞り込むことが出来る。
引数はセレクターの後に四角括弧を追記し、その中にコンマで区切って値を書く:
@<セレクター>[<引数>=<値>,<引数>=<値>,…]
.
括弧の中のスペースは無効であり、引数の値を区切るにはコンマだけが有効である。
引数では大文字と小文字は区別され、未知の引数を書いた場合は無視される。例えば、kill @e[type=creeper,r=20]
は半径20ブロック以内の全てのクリーパーをキルするが、 kill @e[Type=creeper,r=20]
('type' 内の 'T' が大文字)と書くとクリーパーだけを指定するはずの 'type' の書き方が間違っているため、半径20ブロック以内の全てのエンティティがキルされる。
x
、y
、z
、r
の4つの引数は、最初に書く場合は単純に数値だけを書いて指定できる。したがって、以下の2つのコマンドは同じ意味である:
/gamemode creative @a[x=10,y=20,z=30,r=4]
/gamemode creative @a[10,20,30,4]
- 座標で対象を絞り込む
[x=X,y=Y,z=Z]
― 指定した座標のターゲットを対象にする。合わせて半径も指定することで、指定した座標の周囲を対象にできる。
- 座標の値は正確な整数である必要がある ― チルダ表記法はこの引数では使えない。
- 半径で対象を絞り込む
[r=R]
― コマンドが実行された座標を中心に、半径 R ブロック以内を対象とする。[rm=RM]
― コマンドが実行された座標を中心に、半径 RM ブロック以上を対象とする。
- 合わせて座標の引数を使った場合は、コマンドを実行した場所よりも引数で指定した座標が優先される。 非常に遠い座標と非常に大きい半径を指定すれば、直線に近い範囲を対象にすることができる。
- 範囲で絞り込む
[dx=DX,dy=DY,dz=DZ]
- コマンドが実行された座標、 またはコマンド内で指定された座標を中心とした特定の範囲のターゲットを対象にする。DX は "x" 方向(すなわち東 / 西)、 DY は "y" 方向(すなわち上 / 下)、DZ は "z" 方向(すなわち北 / 南)の範囲を意味している。一緒に
x
、y
、z
の引数を指定した場合は、コマンドが実行された座標よりそれらを優先して範囲の北西の角とする(dx
、dy
、dz
は中心からの距離を示すものであり、別々の座標を指定するものではない)。
- もし半径の引数と合わせて使った場合は、半径と範囲が重なった部分だけを対象とする(範囲の北西の角からの半径を指定でき、範囲の外は対象にならない)。
- スコアの値で絞り込む
[score_スコア名=数値]
― スコア名 が 数値 以上でない全てのターゲットを対象にする。
[score_スコア名_min=最小値]
― スコア名 が 最小値 未満でない全てのターゲットを対象にする。
- 例えば、
@a[score_points_min=30,score_points=39]
は points というスコアの値が30以上39以下のターゲットを対象にする(包括的に)。
- タグで絞り込む
[tag=タグ名]
— スコアボードのタグ「タグ名」が与えられた対象のみを絞り込む。[tag=!タグ名]
— スコアボードのタグ「タグ名」が与えられていない対象のみを絞り込む。[tag=]
— 任意のスコアボードのタグがない対象のみを絞り込む。[tag=!]
— 任意のスコアボードのタグがある対象のみを絞り込む。
- チームで絞り込む
[team=チーム名]
― 指定したチームに所属するターゲットを対象にする。
[team=!チーム名]
― 指定したチームに所属しないターゲットを対象にする。
[team=]
― どのチームにも所属していないターゲットを対象にする。
- 数で絞り込む
[c=C]
― 指定された数のターゲットを対象とする。 コマンドが実行された場所からの距離の順に選ばれる。
@p
または@r
セレクターでは、このc
引数の値はデフォルトで1である。よってc
引数を使うことで対象となるターゲットの数を増加させることができる。@a
または@e
セレクターと合わせて使えば、最寄りのターゲットを対象にできる。
- もし同じ距離に複数のターゲットが存在した場合は、サーバーに存在した時間(最近のゲーム参加またはエンティティが作成されてからの時間)を基準に対象が選ばれる。最も時間が長いターゲットが優先して選ばれる。 例えば 同じ距離に存在した場合、
@a[c=1]
は最も長くサーバーに存在したターゲット一つを対象にし、@e[type=creeper,c=3]
は3体の存在した時間が長いクリーパーが対象になる。
- マイナスの値を指定した場合は、対象となる順番が反転する。 例えば、
@p[c=-3]
は3つの最も遠いプレイヤーを対象にする。もし対象にされうるターゲットが全て同じ距離に存在した場合は、@e[c=-3]
は3つの最近参加した/作成されたターゲットが対象になる。
- 経験値レベルで絞り込む
[l=L]
― レベルが L 以上ではない全てのターゲットを対象にする。
[lm=LM]
― レベルが LM 未満ではない全てのターゲットを対象にする。
- ゲームモードで絞り込む
[m=M]
― 指定されたゲームモードの人だけを対象にする。[m=!M]
― 指定されたゲームモード以外の人を対象にする。- 'M' に入る許可された値は以下のとおりである:
-1
: 全てのゲームモード0
、s
、survival
: サバイバルモード1
、c
、creative
: クリエイティブモード2
、a
、adventure
: アドベンチャーモード3
、sp
、spectator
: スペクテイターモード
- 名前で絞り込む
[name=NAME]
― NAME という名前のターゲットを対象にする。
[name=!NAME]
― NAME という名前ではないターゲットを対象にする。
- 縦向きの回転で絞り込む
[rx=RX]
― 縦向きの回転の値が RX 以下のターゲットを対象にする。[rxm=RXM]
― 縦向きの回転の値が RXM 以上のターゲットを対象にする。
- 縦向きの回転の値は-90.0(真上を向いた際の数値)から90.0(真下を向いた際の数値)の間で変化する(したがって、下向きの回転で値が増加する)。
- 水平方向の回転で絞り込む
[ry=RY]
― 水平方向の回転の値が RY 以下のターゲットを対象にする。[rym=RYM]
― 水平方向の回転の値が RYM 以上のターゲットを対象にする。
- 水平方向の回転の値は-180.0(北を向いた際の値)から-90.0(東を向いた際の値)、0.0(南を向いた際の値)、90.0(西を向いた際の値)、179.9(北の少し西を向いた際の値)、そして-180.0に戻ってくるまで変化する。(したがって、右方向すなわち時計回りに回転すると値は増加する)。
- 種類で絞り込む
[type=TYPE]
― 指定した種類のエンティティを対象にする。[type=!TYPE]
― 指定した種類ではないエンティティを対象にする。
- TYPE は内部的なエンティティの種類を指定するエンティティIDである必要がある(例えば、
creeper
はクリーパー、minecart
は通常のトロッコ、tnt
は着火されたTNT、など)。 エンティティIDは大文字と小文字が区別され、間違ったIDを指定するとコマンドの実行に失敗する。
@r
セレクターと合わせて使えば、@r
セレクターの対象をプレイヤーから他のエンティティに変更することが出来る。
データタグ
データタグ (Data tag) は、属性と値のペアを使用してデータの構造を記述する一連のテキストファイルのことである。データタグは、プレイヤー、エンティティ、および一部のブロックの複雑なデータを指定するために、コマンドで使用される。
データタグは、いくつかの属性と値のペアで構成され、コンマで区切られ、中括弧で仕切られている。各属性値のペアは、属性とその値で構成され、二つの情報の間はコロンで区切られている。ただし、一部の属性には、値が複数含まれているため、属性に対してさらにデータタグを用いて、その構造を正確に記述できる。
- 例:
{name1:123,name2:"テキスト",name3:{subname1:456,subname2:789}}
データタグを用いて記述するデータは、Minecraft のセーブデータで使用されるものと同じである。セーブデータのデータ構造は他の記事で説明されており、この記事でデータタグを解説する際は、原則その記事と同じ属性と名前(大文字と小文字は区別する)を使用している。
種類 | 例 |
---|---|
ブロックエンティティ | チェスト、かまど、コマンドブロック、モンスタースポナー、看板など |
アイテム | インベントリ上のアイテム(エンチャント、説明文、変更された名前などを含んでいるもの) |
ドロップアイテム | ドロップしたアイテム |
Mob | クリーパー、ウシ、村人など |
発射物 | 矢、ファイヤーチャージ、スプラッシュポーションなど |
乗り物 | ボート、トロッコなど |
落下中のブロック | 着火したTNT、落下中の砂、砂利、金床など |
その他のエンティティ | ロケット花火、絵画、額縁など |
定義されているデータ構造においては、値が正しい属性であることも必要である。
属性 | 説明 |
---|---|
Byte | -128 から 127 までの整数 |
Short | -32,768 から 32,767 までの整数 |
Int | -2,147,483,648 から 2,147,483,647 までの整数 |
Long | -9,223,372,036,854,775,808 から 9,223,372,036,854,775,807 までの整数 |
Float Double |
Float - 32ビット単精度浮動小数点数、例: 3.1415926
Double - 64ビット倍精度浮動小数点数、例: 3.141592653589793 Wikipediaに詳しい解説がある |
String | 二重引用符 (") で囲まれた文字列
文字列にコンマ (,)、中括弧 ({})、または角括弧 ([]) が含まれている場合は、二重引用符を使用する必要がある 文字列の中に二重引用符を含めるには、二重引用符の前にバックスラッシュ(\、環境によっては半角の¥)を追加する
|
List | コンマで区切られ、角括弧で囲まれた複数の値。
値は、同じ属性でなければならず、属性は最初の値によって指定される
|
Int Array | コンマで区切られ、角括弧で囲まれた複数の値
属性が Int に指定された List と考えればよい |
Compound | コンマで区切られ、中括弧で区切られた属性と値の複数のペア
データタグも、Compound の一種である |
Byte Arrayという属性もあるが、コマンドには使用できない。
コマンドの中には、数値の末尾に特定の文字 (B, S, L, F, D) を追加することによって、数値の型を指定する必要があるものがある。例えば、3s
と入力すれば short、3.2f
と入力すれば float、などである。ただし、明示的な指定無しで整数を入力したときの属性が int のため、3i
とすることはできない。文字は大文字でも小文字でも良い。もし文字が使用されておらず、Minecraft が型を指定していないときは、小数であれば double、int に格納できるサイズの整数だった場合は int、どれにも当てはまらない場合は string となる。コンマで区切られたすべての要素が int の場合、角括弧で囲まれた部分全体の属性は Int Array とみなされる。そうでない場合の属性は、List であるとみなされる。ただし例外があり、[]
は空の List とみなされるが、[,]
は空の Int Array とみなされる。
/testfor
、/testforblock
、 /clear
などのコマンドでデータタグが使用されていると、ターゲットとなったエンティティ、ブロック、アイテムの、コマンド内で使用されたデータタグのみが条件としてチェックされる。これは、エンティティ、ブロック、アイテムがデータタグを持っており、コマンドなどで確認することが出来る、という事を意味している。 List や Int Array についても当てはまる。配列内での順序は関係なく、コマンドでチェックされた各要素がリスト内にある限り、他の要素があってもコマンドの実行対象となる。
この形式は、 JSON フォーマットの形式を利用している。
JSONテキスト
The /tellraw
and /title
commands use strict JSON syntax.
Scores and target selectors are evaluated for a Sign when it is placed or edited and for a Written Book when it is "resolved" (opened for the first time after signing). They won't update after that, and they won't work if edited onto an existing sign with an NBT editor, or onto a book that's already marked resolved. There's no way to wrap text onto the next line of a sign or the next page of a book during resolution; instead, the extra text will simply disappear.
The format of raw JSON text is a JSON Object which supports the following (mostly optional) elements:
- The base chat component Object
- text: A string representing raw text to display directly in chat. Note that selectors such as "@a" and "@p" are not translated into player names; use selector instead. "\n" is newline (enter).
- extra: A list of additional objects, sharing the same format as the base object.
- A list element with the same format as the base object (recursive). Note that all properties of this object are inherited by children except for text, extra, translate, with, and score. This means that children will retain the same formatting and events as this object unless they explicitly override them.
- color: The color to render this text in. Valid values are "black", "dark_blue", "dark_green", "dark_aqua", "dark_red", "dark_purple", "gold", "gray", "dark_gray", "blue", "green", "aqua", "red", "light_purple", "yellow", "white", and "reset" (cancels out the effects of colors used by parent objects). Technically, "bold", "underline", "italic", "strikethrough", and "obfuscated" are also accepted, but it may be better practice to use the tags below for such formats.
- bold: Boolean (true/false) - whether to render text in bold. Defaults to false.
- underlined: Boolean (true/false) - whether to render text underlined. Defaults to false.
- italic: Boolean (true/false) - whether to render text in italics. Defaults to false.
- strikethrough: Boolean (true/false) - whether to render text with a strikethrough. Defaults to false.
- obfuscated: Boolean (true/false) - whether to render text obfuscated. Defaults to false.
- insertion: When the text is shift-clicked by a player, this string will be inserted in their chat input. It will not overwrite any existing text the player was writing.
- clickEvent: Allows for events to occur when the player clicks on text.
- action: The action to perform when clicked. Valid values are "open_url" (opens value as a URL in the player's default web browser), "open_file" (opens the value file on the users computer), "twitch_user_info" (opens info about a twitch user), "run_command" (has value entered in chat as though the player typed it themselves. This can be used to run commands, but the command will fail if the player does not have the required permissions to use it), "change_page" (can only be used in written books) changes to page value if that page exists, and "suggest_command" (similar to "run_command", but the text only appears in the player's chat input, and is not automatically entered. Unlike insertion, this will replace the existing contents of the chat input). "open_file" and "twitch_user_info" cannot be used with commands.
- value: The URL, file, twitch user, chat, command or book page used by the specified action. Note that commands must be prefixed with the usual "/" slash.
- hoverEvent: Allows for a tooltip to be displayed when the player hovers their mouse over text.
- action: The type of tooltip to show. Valid values are "show_text" (shows raw JSON text), "show_item" (shows the tooltip of an item which can have NBT tags), "show_achievement" (shows formatted text describing an achievement or statistic. Normal achievement names are green, final achievement names are dark_purple, and statistic names are gray. In addition, a description is given for achievements), and "show_entity" (shows an entity's name, possibly its type, and its UUID).
- value: The formatting of this tag varies depending on the action. Note that "show_text" is the only action to support an Object as the value; all other action values are Strings and should thus be wrapped in quotes.
- "show_text": Can be either a raw String of text, or an Object with the same formatting as this base object. Note that clickEvent and hoverEvent do not function within the tooltip, but the formatting and extra tags still work.
- "show_item": A string formatted like item NBT data. Contains the "id" tag, and optionally the "Damage" tag and "tag" tag (which is the same compound used as "dataTag" in the
/give
command). - "show_achievement": The achievement or statistic's name. This uses the same format as achievement and statistic Scoreboard objective criteria and the
/achievement
command. - "show_entity": A string formatted like a compound with the string values "type" (such as "Zombie"), "name", and "id" (should be an entity UUID, but can actually be any string).
- translate: The translation identifier of text to be displayed using the player's selected language. This identifier is the same as the identifiers found in lang files from assets or resource packs. The translated text will only be displayed if the text string is not used.
- with: A list of chat component arguments and/or string arguments to be used by translate.
- The arguments are text corresponding to the arguments used by the translation string in the current language, in order (for example, the first list element corresponds to "%1$s" in a translation string).
- score: A player's score in an objective. Displays nothing if the player is not tracked in the given objective. Ignored completely if text or translate is present.
- name: The name of the player whose score should be displayed. Selectors (such as @p) can be used, in addition to "fake" player names created by the scoreboard system. In addition, if the name is "*", it will show the reader's own score (for example,
/tellraw @a {score:{name:"*",objective:"obj"}}
will show every online player their own score in the "obj" objective). Note that non-player entity scores (such as @e[type=Cow]) do not show, even if the entity has been given a score in the objective. - objective: The internal name of the objective to display the player's score in.
- value: Optional. If present, this value is used regardless of what the score would have been.
- name: The name of the player whose score should be displayed. Selectors (such as @p) can be used, in addition to "fake" player names created by the scoreboard system. In addition, if the name is "*", it will show the reader's own score (for example,
- selector: A string containing a selector (@p,@a,@r, or @e) and, optionally, selector arguments. Unlike text, the selector will be translated into the correct player/entity names. If more than one player/entity is detected by the selector, it will be displayed in a form such as 'Name1 and Name2' or 'Name1, Name2, Name3, and Name4'. Ignored completely if text, translate, or score is present. Clicking a player's name inserted into a /tellraw command this way will suggest a command to whisper to that player. Shift-clicking a player's name will insert that name into chat. Shift-clicking a non-player entity's name will insert its UUID into chat.
Due to the extra tag, the above format may be recursively nested to produce very complex and functional text strings. However, a raw json text doesn't have to be complicated at all: virtually all properties are optional and may be left out.
To be valid, each object must have at least either text, translate, score or selector (everything else is optional). As a matter of shorthand, however, the entire Object may be substituted with a String. In this case, that string will be considered the value of the text property. For example, "This is raw text"
is equivalent to {text:"This is raw text"}
. This shorthand substitution is valid anywhere a raw text object is required (including the base <raw json message> argument of /tellraw
, the elements of the extra list, and the value of a "show_text" hover_event).
/tellraw also accepts an array of objects and/or strings; they are concatenated. It even accepts a tree of nested arrays; they are traversed depth-first. For example:
/tellraw @a ["Hello there, ",{selector:"@p"},"."] /tellraw @a [[[["The "],[["quick ","brown "],[{selector:"@p"}," jumps "],"over "],"the "],["lazy ","dog."]]]
Finally, unlike other commands using JSON, /tellraw
Strings support Unicode via the notation \u####
, where #### is the Unicode hexadecimal number for the desired character.
- External links
ブロック/アイテム名
コマンドの中には引数に特定のブロック・アイテムのIDを必要とするものが多くある。
以下のコマンド構文において通常では、<Block>
、 <TileName>
、<Item>
などの要素として表示され、例のようにminecraft:stone
などのIDに置き換えられる。PC版ではそれらのIDには"minecraft:
"を付ける必要がある。Pocket Editionでは付ける必要は無い。
各コマンドの概要
以下の表は、各コマンドの概要を示している。行ごとに並べ替え出来る。
コマンド | 説明 | OPレベル | MP限定 | PE | EE | ||||
---|---|---|---|---|---|---|---|---|---|
/ability
|
プレイヤーに能力を付与または取り消す。 | 0 | — | — | — | — | — | EE限定 | |
/achievement
|
プレイヤーに実績を与えたり削除したりする。 | 2 | — | — | — | — | — | — | |
/advancement
|
プレイヤーに進捗を与えたり削除したりチェックしたりする。 | 2 | — | — | — | — | — | — | |
/ban
|
BAN一覧にプレイヤーを追加する。 | 3 | MP | — | — | — | — | — | |
/ban-ip
|
BAN一覧にIPアドレスを追加する。 | 3 | MP | — | — | — | — | — | |
/banlist
|
BAN一覧を表示する。 | 3 | MP | — | — | — | — | — | |
/blockdata
|
ブロックのデータタグを編集する。 | 2 | — | — | — | — | — | — | |
/clear
|
プレイヤーのインベントリからアイテムを消去する。 | 2 | — | — | — | — | はい | ? | |
/clone
|
ブロックのまとまりをコピー/移動させる。 | 2 | — | — | — | — | はい | Yes | |
/debug
|
デバッグを開始/停止する。 | 3 | — | — | — | — | — | — | — |
/defaultgamemode
|
デフォルトのゲームモードを設定する。 | 2 | — | — | — | — | — | — | |
/deop
|
プレイヤーの管理者権限を削除する。 | 3 | MP | — | — | — | はい | ? | |
/difficulty
|
難易度を設定する。 | 2 | — | — | — | — | はい | ? | |
/effect
|
ステータス効果を付与/削除する。 | 2 | — | — | — | はい | ? | ||
/enchant
|
プレイヤーのアイテムをエンチャントする。 | 2 | — | — | — | — | はい | ? | |
/entitydata
|
エンティティのデータタグを編集する。 | 2 | — | — | — | — | — | — | |
/execute
|
プレイヤー/エンティティにコマンドを実行させる。 | 2 | — | — | — | — | — | はい | ? |
/fill
|
ブロックを一括で設置する。 | 2 | — | — | — | — | はい | ? | |
/function
|
関数を実行する。 | 2 | — | — | — | — | — | — | — |
/gamemode
|
プレイヤーのゲームモードを設定する。 | 2 | — | — | — | — | はい | ? | |
/gamerule
|
ゲームルールを設定する。 | 2 | — | — | — | — | はい | はい | |
/give
|
プレイヤーにアイテムを与える。 | 2 | — | — | — | — | はい | ? | |
/help
|
コマンドのヘルプを表示する。 | 0 | — | — | — | — | — | はい | ? |
/kick
|
プレイヤーをキックする。 | 3 | MP | — | — | — | — | — | |
/kill
|
エンティティ(プレイヤー、Mob、アイテムなど)をキル(抹消)する。 | 2 | — | — | — | はい | ? | ||
/list
|
サーバーのプレイヤー一覧を表示する。 | 0 | MP | — | — | — | はい | ? | |
/locate
|
最も近い構造物の座標を表示する。 | 2 | — | — | — | — | はい | ? | |
/me
|
自分自身に関するメッセージを表示する。 | 0 | — | — | — | — | はい | ? | |
/op
|
プレイヤーに管理者権限を与える。 | 3 | MP | — | — | — | はい | ? | |
/pardon
|
BAN一覧から項目を削除する。 | 3 | MP | — | — | — | — | — | |
/particle
|
パーティクルを表示する。 | 2 | — | — | — | — | — | ? | |
/playsound
|
サウンドを再生する。 | 2 | — | — | — | — | はい | ? | |
/publish
|
ワールドをローカルのネットワークに開放する。 | 4 | SP限定 | — | — | — | — | ? | |
/recipe
|
プレイヤーのレシピを解除したり、ロックしたりする。 | 2 | — | — | — | — | — | ? | |
/reload
|
ルートテーブル、進捗、関数をディスクから再読み込みする。 | 4 | — | — | — | — | — | ? | |
/replaceitem
|
インベントリのアイテムを置き換える。 | 2 | — | — | はい | ? | |||
/save-all
|
サーバーのワールドをセーブする。 | 4 | MP | — | — | — | — | ? | |
/save-off
|
サーバーの自動セーブを無効にする。 | 4 | MP | — | — | — | — | ? | |
/save-on
|
サーバーの自動セーブを有効にする。 | 4 | MP | — | — | — | — | ? | |
/say
|
複数のプレイヤーにメッセージを表示する。 | 2 | — | — | — | — | — | はい | ? |
/scoreboard
|
対象、プレイヤー、チーム、タグを管理する。 | 2 | — | — | — | — | ? | ||
/seed
|
シード値を表示する。 | 2 | — | — | — | — | — | ? | |
/setblock
|
ブロックを設置 / 置換する。 | 2 | — | — | — | — | はい | ? | |
/setidletimeout
|
何もしていないプレイヤーがキックされる時間を設定する。 | 3 | MP | — | — | — | — | ? | |
/setmaxplayers
|
参加が許可されているプレイヤーの最大数を設定する。 | 0 | — | — | — | — | PE限定 | ? | |
/setworldspawn
|
ワールドのスポーン地点を設定する。 | 2 | — | — | — | — | はい | ? | |
/spawnpoint
|
プレイヤーのスポーン地点を設定する。 | 2 | — | — | — | — | はい | ? | |
/spreadplayers
|
エンティティをランダムな場所に配置する。 | 2 | — | — | — | はい | ? | ||
/stats
|
コマンドの結果を使って対象を更新する。 | 2 | — | — | — | ? | |||
/stop
|
サーバーを停止する。 | 4 | MP | — | — | — | — | ? | |
/stopsound
|
サウンドを停止する。 | 2 | — | — | — | — | はい | ? | |
/summon
|
エンティティを召喚する。 | 2 | — | — | — | — | はい | ? | |
/teleport
|
エンティティをテレポートさせる。 | 2 | — | — | — | はい | ? | ||
/tell
|
他のプレイヤーにプライベートメッセージを送信する。 | 0 | — | — | — | — | はい | ? | |
/tellraw
|
プレイヤーにJSONテキストを表示する。 | 2 | — | — | — | — | — | ? | |
/testfor
|
条件に合うエンティティを検知する。 | 2 | — | — | — | はい | ? | ||
/testforblock
|
特定の位置に指定したブロックがあるかどうかを検知する。 | 2 | — | — | — | — | はい | ? | |
/testforblocks
|
2つのブロックのまとまりが一致するかを検知する。 | 2 | — | — | — | — | はい | ? | |
/time
|
ワールドの時間の数値を変更する。 | 2 | — | — | — | — | はい | ? | |
/title
|
画面に表示するタイトルを管理する。 | 2 | — | — | — | — | はい | ? | |
/toggledownfall
|
天候を交互に切り替える。 | 2 | — | — | — | — | はい | ? | |
/tp
|
エンティティをテレポートさせる。 | 2 | — | — | — | はい | ? | ||
/transferserver
|
プレイヤーをサーバーに転送する。 | 0 | — | — | — | — | — | PE限定 | ? |
/trigger
|
トリガー型オブジェクトを使用する。 | 0 | — | — | — | — | — | ? | |
/weather
|
天候を設定する。 | 2 | — | — | — | — | はい | ? | |
/whitelist
|
サーバーのホワイトリストを設定する。 | 3 | MP | — | — | — | — | ? | |
/worldborder
|
ワールドの境界を管理する。 | 2 | — | — | — | — | — | ? | |
/wsserver
|
WebSocketサーバーに接続する。 | 0 | — | — | — | — | — | PE限定 | ? |
/xp
|
プレイヤーの経験値を追加/削除する。 | 2 | — | — | — | — | はい | ? |
コマンド一覧
advancement
blockdata
clear
clone
debug
defaultgamemode
difficulty
effect
enchant
entitydata
execute
function
gamemode
gamerule
locate
pardon
particle
playsound
publish
recipe
reload
replaceitem
scoreboard
setblock
setidletimeout
setmaxplayers
setworldspawn
spawnpoint
spreadplayers
stats
stopsound
summon
teleport
tellraw
testfor
testforblock
testforblocks
title
toggledownfall
transferserver
trigger
weather
whitelist
worldborder
wsserver
動画
歴史
Java Edition Classic | |||||
---|---|---|---|---|---|
0.0.15a_03 | /ban 、/banip 、/broadcast 、/deop 、/kick 、/op 、/tp そして /unban が追加された。 | ||||
0.0.16a_01 | /broadcast が /say に変更された。 | ||||
0.0.17a | /setspawn が追加された。 | ||||
0.0.20a | /solid が追加された。 | ||||
Java Edition Indev | |||||
0.31 | 全てのコマンドが削除された。 | ||||
Java Edition Alpha | |||||
1.0.16 | /ban 、/ban-ip 、/banlist 、/deop 、/home 、/kick 、/op 、/pardon 、/pardon-ip 、/say そして /stop が追加された。 | ||||
1.0.16_01 | /save-all 、/save-on 、/save-off そして /tp が追加された。 | ||||
1.0.16_02 | /list と /tell が追加された。 | ||||
1.2.5 | /home が削除された。 | ||||
1.2.6 | /kill が追加された。 | ||||
Java Edition Beta | |||||
1.3 | /whitelist が追加された。 | ||||
Java Edition | |||||
1.3.1 | 12w16a | チートモードと /gamemode 、/give 、/time 、/toggledownfall そして /xp が追加された。 | |||
12w17a | /help が追加された。 | ||||
12w21a | /seed が追加された。 | ||||
12w22a | /defaultgamemode が追加された。 | ||||
12w24a | /publish が追加された。 | ||||
12w25a | ワールドを LAN に公開することでチートをオンまたはオフにできるようになった。 | ||||
12w27a | /debug が追加された。 | ||||
? | /me が追加された。 | ||||
1.4.2 | 12w32a | /difficulty 、/gamerule 、/spawnpoint そして /weather が追加された。
| |||
ターゲットセレクターが追加された。 | |||||
12w37a | /clear が追加された。 | ||||
12w38a | Added item arguments to /clear . | ||||
12w41a | /xp の制限が5,000から2,147,483,647に変更された。 | ||||
1.4.4 | 1.4.4-pre | /enchant が追加された。 | |||
1.5 | 13w03a | /testfor が追加された。 | |||
13w04a | /scoreboard が追加された。 | ||||
13w09b | /effect が追加された。 | ||||
1.6.1 | 13w23a | /spreadplayers が追加された。 | |||
naturalRegeneration のゲームルールが追加された。 | |||||
13w24a | doDaylightCycle のゲームルールが追加された。 | ||||
13w24b | /kill で与えられるダメージが1,000から3.4×1038へ変更された。 | ||||
1.6-pre | /effect に clear 引数が追加された。 | ||||
1.6.1-pre | /playsound が追加された。 | ||||
1.7.2 | 13w36a | /summon が追加された。 | |||
/achievement が追加された。 | |||||
/give に dataTag 引数が追加された。 | |||||
13w37a | /setblock 、/tellraw そして /testforblock が追加された。 | ||||
13w38a | /setidletimeout が追加された。 | ||||
13w43a | /setworldspawn が追加された。 | ||||
1.8 | 14w02a | /blockdata が追加された。
| |||
@e のターゲットセレクターが追加された。 | |||||
/kill に player|entity 引数が追加された。 | |||||
/clear に data 引数が追加された。 | |||||
/testfor に dataTag 引数が追加された。 | |||||
/testfor がコマンドブロックでしか使えなくなった。 | |||||
JSONテキストの仕様に insertion の属性が追加された。 | |||||
14w02c | MC-44371 を修正するために、3.4×1038ダメージを与えるのではなく、ターゲットを直接殺すようになった。 | ||||
14w03a | /tp に回転引数が追加された。 | ||||
ターゲットセレクターの引数に dx 、dy そして dz が追加された。 | |||||
/clone と /fill が追加された。 | |||||
logAdminCommands のゲームルールが追加された。 | |||||
NBTデータでは、数値ID ではなく文字列ID の使用がサポートされるようになった。 | |||||
数値ID はコマンドの他の部分では機能しないが、NBTデータではまだ動作する。 | |||||
14w04a | /particle が追加された。 | ||||
14w05a | /gamemode と /defaultgamemode に spectator が追加された。 | ||||
14w06a | /effect に hideParticles の引数が追加された。
| ||||
/trigger が追加された。 | |||||
14w07a | /execute と /testforblocks が追加された。
| ||||
/testfor が部分的な NBTタグの一致をテストできるようになった。 | |||||
14w08a | Commands run using /execute now pass their success value back to the command block running them. | ||||
14w10a | showDeathMessages のゲームルールが追加された。
| ||||
/clone に force のオプションが追加された。 | |||||
14w17a | /worldborder が追加された。 | ||||
randomTickSpeed のゲームルールが追加された。 | |||||
14w19a | /worldborder damage と /worldborder warning が追加された。 | ||||
14w20a | /title が追加された。 | ||||
JSONテキストの仕様に selector の属性が追加された。 | |||||
/clone に move のオプションが追加された。 | |||||
14w26a | /worldborder add が追加された。 | ||||
/replaceitem が追加された。 | |||||
sendCommandFeedback のゲームルールが追加された。 | |||||
14w28a | /stats が追加された。 | ||||
14w29a | /worldborder get が追加された。 | ||||
/particle に force の引数が追加された。 | |||||
Added /time query . | |||||
ダミーのゲームルールを作成する機能が追加された。 | |||||
/stats に QueryResults が追加された。 | |||||
14w30a | /summon で雷をスポーンさせられるようになった。 | ||||
14w31a | /debug がシングルプレイヤーでのみ実行できるようになった。 | ||||
/debug に chunk の引数が追加された。 | |||||
14w32b | /entitydata が追加された。 | ||||
/give で不正なスタック(64以上のスタック)を作ることができなくなった。 | |||||
1.8.1 | 1.8.1-pre1 | doEntityDrops のゲームルールが追加された。 | |||
doTileDrops のゲームルールがエンティティに影響を与えなくなった。 | |||||
1.9 | 15w43a | /gamemode が、プレイヤーがゲームモードを切り替えた時にチャットで表示されるようになった。 | |||
15w49a | /playsound now accepts Tab to complete.
| ||||
/particle に player と params のタグが追加された。 | |||||
15w49b | /time query now accepts day as a value. | ||||
15w51a | spawnRadius のゲームルールが追加された。 | ||||
16w02a | The m selector now accepts the standard literal gamemode values and abbreviations, such as a and adventure , and these may be negated as well. | ||||
/playsound now requires a source parameter, specifying what is the sound's category for volume purposes. | |||||
Running /help in a command block will now randomly use one of various different humorous phrases as the previous output. | |||||
16w03a | /achievement が統計情報に影響を与えなくなった。 | ||||
16w07a | disableElytraMovementCheck のゲームルールが追加された。 | ||||
1.9.3 | pre1 | /tp will no longer teleport the player to a y-coordinate outside the range -512 to 512. | |||
pre2 | Added /stopsound . | ||||
1.10 | 16w21b | The y-coordinate range of /tp is increased to -4096 to 4096. | |||
1.10-pre1 | Added /teleport , which is like /tp , except that the target parameter is mandatory, the 'teleport to other player' usage is unavailable, and the use of relative coordinates is relative to the executor of the command, rather than relative to the target. | ||||
1.11 | 16w32a | Added block state support to /execute , /fill , /setblock and /testforblock . | |||
16w32b | Added ability for /title to display text in the action bar position. | ||||
16w38a | Added gamerules doWeatherCycle and maxEntityCramming .
| ||||
Removed implicit target selectors (for example, @e[167,28,454] ). | |||||
Invalid target selectors (such as @e[Type=creeper] , @e[asdf=nonexistent] , and @e[malformed] ) now generate an error instead of being silently ignored. | |||||
16w39a | Added /locate . | ||||
Java Edition | |||||
1.12 | 17w13a | Added /recipe and /advancement .
| |||
Added gamerule doLimitedCrafting . | |||||
Removed /achievement . | |||||
17w16b | Added gamerule maxCommandChainLength . | ||||
Pocket Edition Alpha | |||||
0.7.4 | Added support for commands, though none are implemented yet. | ||||
0.16.0 | build 1 | Added /clearfixedinv , /clone , /deop , /execute , /fill , /gamemode , /give , /help (with alias /? ), /kill , /list , /op , /say , /setblock , /setfixedinvslot , /setworldspawn , /spawnpoint , /summon , /tell (with aliases /msg and /w ), /testforblock , /testforblocks , /time , /toggledownfall , /tp (with alias /teleport ), /weather , /wsserver and /xp .
| |||
Functionality of most commands is equivalent to PC 1.10 usage. Differences include: no support for datatags, /clone cannot use forced cloneMode, /gamemode can only use Creative and Survival modes, the player target is optional in /give , and the entity target is optional in /execute . | |||||
build 2 | Removed /clearfixedinv and /setfixedinvslot , along with other Education Edition -related items. | ||||
build 5 | Added /enchant . | ||||
Pocket Edition | |||||
1.0 | build 1 | Added /locate and /connect . | |||
build 2 | Removed /locate . | ||||
build 3 | Re-added /locate . Only works for strongholds. | ||||
1.0.3 | build 1 | Added /transferserver . | |||
1.0.5 | build 1 | Added /clear , /difficulty , /effect , /gamerule , /me , /particle , /playsound , /replaceitem , /spreadplayers , /stopsound , /testfor and /title . | |||
build 2 | Removed /particle .
| ||||
The amplifier on /effect can no longer have negative values. | |||||
Pocket Edition | |||||
1.1 | build 1 | The canplaceon and candestroy are now supported for /replaceitem .
| |||
/locate can now find other structures. | |||||
Added dodaylightcycle , doentitydrops , dofiretick , domobspawning , domobloot , dotiledrops , doweathercycle , keepinventory and mobgriefing gamerules. | |||||
Bedrock Edition | |||||
1.2 | build 1 | Added /tickingarea . |
豆知識
- ゲームルール "doFireTick" が "false" にされると、炎は広がらないが、設置されたブロックの如何によらず燃え続け、雨で消え去ることも無くなる。これは雷雨の間は、落雷によりそれなりな数の火災が発生するのでプレイヤーがいちいち消して回らねばならなくなり、非常に困ったものになる。
- ステータス効果「耐性」のレベル5(増幅度4)を得ているときは、
/kill
コマンドは機能しなくなる。- これはバージョン1.6で修正された(13w24bでも修正済み)。