メインコンテンツまでスキップ

playerPlaceBlock

説明

プレイヤーがブロックを設置したときにトリガーされるイベントです。


トリガータグ

イベントがトリガーされたとき、プレイヤーに自動付与されるタグです。

タグ名説明
capi:placeこのイベントがトリガーされたとき、プレイヤーに自動付与されます。
place:{ブロックID}設置したブロックのIDがタグとして付与されます。

トリガースコア

イベントがトリガーされたとき、自動で更新されるスコアボードです。

スコアボード名説明
capi:place_x設置したブロックのX座標です。
capi:place_y設置したブロックのY座標です。
capi:place_z設置したブロックのZ座標です。

使用例

基本的な検出

特定のブロックを設置したプレイヤーを検出する例:

/execute as @a[tag=place:minecraft:tnt] run say TNTを設置しました!

危険ブロックの監視

危険なブロックの設置を検出して警告する例:

# TNTの設置を警告
/execute as @a[tag=place:minecraft:tnt] run tellraw @a [{"selector":"@s"},"§c がTNTを設置しました!"]
/execute as @a[tag=place:minecraft:tnt] run playsound block.note_block.pling @a ~ ~ ~ 1 0.5

# 溶岩の設置を記録
/execute as @a[tag=place:minecraft:lava] run scoreboard players add @s lava_placed 1
/execute as @a[tag=place:minecraft:lava] run tellraw @s "§6溶岩設置注意!周囲に注意してください"

# 火の設置を制限
/execute as @a[tag=place:minecraft:fire] run tellraw @s "§c火の設置は禁止されています"
/execute as @a[tag=place:minecraft:fire] run fill ~ ~ ~ ~ ~ ~ air replace fire

建築統計の記録

設置したブロックの統計を記録する例:

# 全てのブロック設置をカウント
/execute as @a[tag=capi:place] run scoreboard players add @s blocks_placed 1

# マイルストーン達成
/execute as @a[tag=capi:place,scores={blocks_placed=1000}] run tellraw @s "§6§l1000ブロック設置達成!"
/execute as @a[tag=capi:place,scores={blocks_placed=10000}] run tellraw @s "§6§l10000ブロック設置達成!マスタービルダー!"

# 特定ブロックのカウント
/execute as @a[tag=place:minecraft:stone_bricks] run scoreboard players add @s stone_bricks_placed 1
/execute as @a[tag=place:minecraft:oak_planks] run scoreboard players add @s planks_placed 1

保護エリアでの設置制限

特定エリアでのブロック設置を制限する例:

# スポーンエリアでの設置を禁止(座標: -50~50, Y: 60~100, -50~50)
/execute as @a[tag=capi:place,scores={capi:place_x=-50..50,capi:place_y=60..100,capi:place_z=-50..50}] run fill ~ ~ ~ ~ ~ ~ air
/execute as @a[tag=capi:place,scores={capi:place_x=-50..50,capi:place_y=60..100,capi:place_z=-50..50}] run tellraw @s "§cスポーンエリアでは建築できません"

# VIPエリアでの設置許可
/execute as @a[tag=capi:place,tag=!vip,scores={capi:place_x=100..200,capi:place_z=100..200}] run fill ~ ~ ~ ~ ~ ~ air
/execute as @a[tag=capi:place,tag=!vip,scores={capi:place_x=100..200,capi:place_z=100..200}] run tellraw @s "§cこのエリアはVIP専用です"

自動建築アシスト

ブロック設置時に便利な機能を提供する例:

# 松明を設置すると周囲も明るくする
/execute as @a[tag=place:minecraft:torch] run fill ~-2 ~ ~-2 ~2 ~ ~2 torch replace air
/execute as @a[tag=place:minecraft:torch] run tellraw @s "§e周囲に松明を自動設置しました"

# ガラスを設置すると自動的に窓枠を作る
/execute as @a[tag=place:minecraft:glass] run fill ~-1 ~ ~ ~1 ~ ~ oak_planks
/execute as @a[tag=place:minecraft:glass] run fill ~ ~-1 ~ ~ ~1 ~ oak_planks

建築コンテストシステム

建築コンテスト用のブロック設置カウント:

# コンテスト中のブロック設置をカウント
/execute as @a[tag=capi:place,tag=contest_participant] run scoreboard players add @s contest_blocks 1
/execute as @a[tag=capi:place,tag=contest_participant] run title @s actionbar §6設置ブロック数をカウント中

# 使用可能なブロック制限
/execute as @a[tag=capi:place,tag=contest_participant,scores={contest_blocks=1000..}] run tellraw @s "§cブロック設置上限に達しました"
/execute as @a[tag=capi:place,tag=contest_participant,scores={contest_blocks=1000..}] run fill ~ ~ ~ ~ ~ ~ air

クリエイティブモード制限

サバイバルでの特定ブロック設置を制限:

# クリエイティブ限定ブロック
/execute as @a[tag=place:minecraft:bedrock,gamemode=!creative] run fill ~ ~ ~ ~ ~ ~ air
/execute as @a[tag=place:minecraft:bedrock,gamemode=!creative] run tellraw @s "§c岩盤はクリエイティブモードでのみ設置できます"

/execute as @a[tag=place:minecraft:barrier,gamemode=!creative] run fill ~ ~ ~ ~ ~ ~ air
/execute as @a[tag=place:minecraft:barrier,gamemode=!creative] run tellraw @s "§cバリアブロックはクリエイティブモードでのみ設置できます"

設置位置の記録

重要なブロックの設置位置を記録する例:

# ビーコンの設置位置を記録
/execute as @a[tag=place:minecraft:beacon] run tellraw @a "§b§lビーコンが設置されました"

# チェストの設置を記録
/execute as @a[tag=place:minecraft:chest] run scoreboard players add @s chests_placed 1
/execute as @a[tag=place:minecraft:chest] run tellraw @s "§eチェストを設置しました"

季節イベント用の設置制限

特定の期間のみ設置可能なブロック:

# クリスマスイベント期間のみ設置可能
/execute as @a[tag=place:minecraft:snow_block,scores={event_christmas=0}] run fill ~ ~ ~ ~ ~ ~ air
/execute as @a[tag=place:minecraft:snow_block,scores={event_christmas=0}] run tellraw @s "§c雪ブロックはクリスマスイベント期間のみ設置できます"

# イベント期間中
/execute as @a[tag=place:minecraft:snow_block,scores={event_christmas=1}] run tellraw @s "§b素敵なクリスマスデコレーション!"

設置禁止ブロックリスト

グリーフィング防止のためのブロック制限:

# 設置禁止ブロック
/execute as @a[tag=place:minecraft:tnt] run fill ~ ~ ~ ~ ~ ~ air
/execute as @a[tag=place:minecraft:obsidian] run fill ~ ~ ~ ~ ~ ~ air
/execute as @a[tag=place:minecraft:water] run fill ~ ~ ~ ~ ~ ~ air
/execute as @a[tag=place:minecraft:lava] run fill ~ ~ ~ ~ ~ ~ air

# 違反を記録
/execute as @a[tag=place:minecraft:tnt] run scoreboard players add @s violations 1
/execute as @a[tag=place:minecraft:tnt] run tellraw @s "§c§l警告:禁止ブロックの設置が検出されました"

資材使用効率の追跡

設置したブロックの価値を計算する例:

# ダイヤモンドブロックの設置
/execute as @a[tag=place:minecraft:diamond_block] run scoreboard players add @s wealth 9000
/execute as @a[tag=place:minecraft:diamond_block] run tellraw @s "§b資産価値を記録しました"

# 金ブロックの設置
/execute as @a[tag=place:minecraft:gold_block] run scoreboard players add @s wealth 1000

# エメラルドブロックの設置
/execute as @a[tag=place:minecraft:emerald_block] run scoreboard players add @s wealth 2000

自動アイテム返却

誤設置時に自動でアイテムを返却する例:

# 水中での松明設置を防止してアイテムを返却
/execute as @a[tag=place:minecraft:torch] if block ~ ~ ~ water run give @s torch 1
/execute as @a[tag=place:minecraft:torch] if block ~ ~ ~ water run fill ~ ~ ~ ~ ~ ~ air replace torch
/execute as @a[tag=place:minecraft:torch] if block ~ ~ ~ water run tellraw @s "§e水中に松明は設置できません"