mirror of
https://github.com/LZStealth/armor-statues.git
synced 2025-08-10 20:45:53 +01:00
Initial commit for armor statues
This commit is contained in:
18
data/armor_statues/functions/locking/lock.mcfunction
Normal file
18
data/armor_statues/functions/locking/lock.mcfunction
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Description: Locks armor stand
|
||||
# Called by: armor_statues:trigger/lock
|
||||
# Entity @s: armor stand
|
||||
#
|
||||
execute as @p[tag=as_selected,tag=!as_chat] run title @s actionbar {"text":"Armor stand locked","color":"dark_green"}
|
||||
execute as @p[tag=as_selected,tag=as_chat] run tellraw @s {"text":"<Stick_God> Armor stand locked","color":"dark_green"}
|
||||
effect give @s minecraft:glowing 1
|
||||
data merge entity @s {DisabledSlots:4144959}
|
||||
tag @s add as_locked
|
||||
#
|
||||
# add Player UUID lock
|
||||
#
|
||||
execute store result score @s as_lock_uuid1 run data get entity @p[tag=as_selected] UUID[0]
|
||||
execute store result score @s as_lock_uuid2 run data get entity @p[tag=as_selected] UUID[1]
|
||||
execute store result score @s as_lock_uuid3 run data get entity @p[tag=as_selected] UUID[2]
|
||||
execute store result score @s as_lock_uuid4 run data get entity @p[tag=as_selected] UUID[3]
|
||||
tag @s add as_uuid_locked
|
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# Description: Checks if armor stand has old or new lock
|
||||
# Called by: armor_statues:trigger/trigger/lock
|
||||
# Entity @s: Player
|
||||
#
|
||||
execute if entity @s[tag=as_locked,tag=as_uuid_locked] run function armor_statues:locking/uuid_check
|
||||
execute if entity @s[tag=as_locked,tag=!as_uuid_locked] run function armor_statues:locking/unlock
|
18
data/armor_statues/functions/locking/unlock.mcfunction
Normal file
18
data/armor_statues/functions/locking/unlock.mcfunction
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Description: Unlocks locked armor stand
|
||||
# Called by: armor_statues:trigger/lock
|
||||
# Entity @s: nearest locked armor stand
|
||||
#
|
||||
execute as @p[tag=as_selected,tag=!as_chat] run title @s actionbar {"text":"Armor stand unlocked","color":"dark_green"}
|
||||
execute as @p[tag=as_selected,tag=as_chat] run tellraw @s {"text":"<Stick_God> Armor stand unlocked","color":"dark_green"}
|
||||
effect give @s minecraft:glowing 1
|
||||
data merge entity @s {DisabledSlots:0}
|
||||
tag @s remove as_locked
|
||||
#
|
||||
# add Player UUID lock
|
||||
#
|
||||
scoreboard players reset @s as_lock_uuid1
|
||||
scoreboard players reset @s as_lock_uuid2
|
||||
scoreboard players reset @s as_lock_uuid3
|
||||
scoreboard players reset @s as_lock_uuid4
|
||||
tag @s remove as_uuid_locked
|
15
data/armor_statues/functions/locking/uuid_check.mcfunction
Normal file
15
data/armor_statues/functions/locking/uuid_check.mcfunction
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# Description: Checks UUID of player against the UUID of the armor stand and player
|
||||
# Called by: armor_statues:trigger/lock
|
||||
# Entity @s: nearest locked armor stand
|
||||
#
|
||||
execute store result score @p[tag=as_selected] as_lock_uuid1 run data get entity @p[tag=as_selected] UUID[0]
|
||||
execute store result score @p[tag=as_selected] as_lock_uuid2 run data get entity @p[tag=as_selected] UUID[1]
|
||||
execute store result score @p[tag=as_selected] as_lock_uuid3 run data get entity @p[tag=as_selected] UUID[2]
|
||||
execute store result score @p[tag=as_selected] as_lock_uuid4 run data get entity @p[tag=as_selected] UUID[3]
|
||||
#
|
||||
scoreboard players set #as_success as_help 0
|
||||
execute store success score #as_success as_help if score @p[tag=as_selected] as_lock_uuid1 = @s as_lock_uuid1 if score @p[tag=as_selected] as_lock_uuid2 = @s as_lock_uuid2 if score @p[tag=as_selected] as_lock_uuid3 = @s as_lock_uuid3 if score @p[tag=as_selected] as_lock_uuid4 = @s as_lock_uuid4 run function armor_statues:locking/unlock
|
||||
#
|
||||
execute if score #as_success as_help matches 0 as @p[tag=as_selected,tag=!as_chat] run title @s actionbar {"text":"Can't modify armor stands locked by a different player","color":"dark_red"}
|
||||
execute if score #as_success as_help matches 0 as @p[tag=as_selected,tag=as_chat] run tellraw @s [{"text":"<Stick_God> ","color":"dark_green"},{"text":"Can't modify armor stands locked by a different player","color":"dark_red"}]
|
Reference in New Issue
Block a user