Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- command /displayitem [<text>]:
- permission: skript.admin
- trigger:
- if target block is glass:
- if player's tool is not air:
- set {_name} to colored arg
- if {_name} is not set:
- set {_name} to check [name of player's tool is set] ? name of player's tool : "%type of player's tool%"
- spawn an armor stand at location 0.5 meter below location of target block
- set {_base} to last spawned armor stand
- add "{Invulnerable:1b,NoGravity:1b,Invisible:1b,NoBasePlate:1b,ShowArms:1b,Small:1b,Marker:1b}" to nbt of {_base}
- drop 1 of player's tool at {_base} without velocity
- set {_item} to dropped item
- add "{PickupDelay:32767s,Age:-32768,Invulnerable:1b}" to nbt of {_item}
- make {_item} ride {_base}
- spawn an armor stand at location 0.5 meter above target block
- set {_hologram} to last spawned armor stand
- add "{CustomName:""%{_name}%"",Invulnerable:1b,NoGravity:1b,Invisible:1b,NoBasePlate:1b,ShowArms:1b,Small:1b,Marker:1b}" to nbt of {_hologram}
- set {_uuid} to uuid of {_base}
- set {itemdisplay.location::%{_uuid}%} to target block
- set {itemdisplay.item::%{_uuid}%} to UUID of {_item}
- set {itemdisplay.hologram::%{_uuid}%} to UUID of {_hologram}
- send "&6アイテムを飾りました"
- else:
- send "&c手にアイテムを持ってください"
- else:
- send "&cガラスブロックに向けてコマンドを実行してください"
- every tick:
- loop {itemdisplay.location::*}:
- set {_base} to entity from uuid loop-index
- set {_item} to entity from uuid {itemdisplay.item::%loop-index%}
- set {_hologram} to entity from uuid {itemdisplay.hologram::%loop-index%}
- make {_item} ride {_base}
- if block at loop-value is not glass:
- kill {_base}
- kill {_item}
- kill {_hologram}
- delete {itemdisplay.location::%loop-index%}
- delete {itemdisplay.item::%loop-index%}
- delete {itemdisplay.hologram::%loop-index%}
- else:
- loop all players:
- if target block of loop-player is block at loop-value-1:
- showCustomNameToPlayer({_hologram}, loop-player)
- else:
- hideCustomNameFromPlayer({_hologram}, loop-player)
- function hideCustomNameFromPlayer(e: entity, p: player):
- set {_packet} to new play_server_entity_metadata packet
- set int pnum 0 of {_packet} to id of {_e}
- set {_json::3} to false
- set "WatchableCollection" pjson 0 of {_packet} to json from listvar {_json::*}
- send {_p} packet {_packet}
- function showCustomNameToPlayer(e: entity, p: player):
- set {_packet} to new play_server_entity_metadata packet
- set int pnum 0 of {_packet} to id of {_e}
- set {_json::3} to true
- set "WatchableCollection" pjson 0 of {_packet} to json from listvar {_json::*}
- send {_p} packet {_packet}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement