From 2d6d90abf3b57f359289c65653a65a0aa7d600cb Mon Sep 17 00:00:00 2001 From: NeunEinser Date: Wed, 3 Mar 2021 17:12:24 +0100 Subject: [PATCH] Lobby: Use function commands on signs instead of /trigger This simplifies the settings logic a bit. Previously, I expected signs would act similarily to other usages of text components, where the player clicking the text component has to have permissions to use the commands. Apparently, signs are special in that regard, though. --- data/bingo/functions/lobby/set_signs.mcfunction | 14 +++++++------- data/bingo/functions/lobby/tick.mcfunction | 5 ----- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/data/bingo/functions/lobby/set_signs.mcfunction b/data/bingo/functions/lobby/set_signs.mcfunction index 83403767..ce028204 100644 --- a/data/bingo/functions/lobby/set_signs.mcfunction +++ b/data/bingo/functions/lobby/set_signs.mcfunction @@ -1,13 +1,13 @@ -setblock -1 65 -6 minecraft:warped_wall_sign[facing=east]{Text1: '{"translate":"bingo.lobby.card_generation.from_seed.sign.line1", "bold":true, "color":"#8eedeb", "clickEvent":{"action":"run_command","value":"trigger bingo.settings set 2"}}', Text2:'{"translate":"bingo.lobby.card_generation.from_seed.sign.line2", "bold":true, "color":"#8eedeb"}', Text3:'{"translate":"bingo.lobby.card_generation.from_seed.sign.line3", "bold":true, "color":"#8eedeb"}', Text4:'{"translate":"bingo.lobby.card_generation.from_seed.sign.line4", "bold":true, "color":"#8eedeb"}'} +setblock -1 65 -6 minecraft:warped_wall_sign[facing=east]{Text1: '{"translate":"bingo.lobby.card_generation.from_seed.sign.line1", "bold":true, "color":"#8eedeb", "clickEvent":{"action":"run_command","value":"/function bingo:card_generation/random_card"}}', Text2:'{"translate":"bingo.lobby.card_generation.from_seed.sign.line2", "bold":true, "color":"#8eedeb"}', Text3:'{"translate":"bingo.lobby.card_generation.from_seed.sign.line3", "bold":true, "color":"#8eedeb"}', Text4:'{"translate":"bingo.lobby.card_generation.from_seed.sign.line4", "bold":true, "color":"#8eedeb"}'} -setblock 1 65 -6 minecraft:warped_wall_sign[facing=west]{Text1: '{"translate":"bingo.lobby.card_generation.random_card.sign.line1", "bold":true, "color":"#8eedeb", "clickEvent":{"action":"run_command","value":"trigger bingo.settings set 2"}}', Text2:'{"translate":"bingo.lobby.card_generation.random_card.sign.line2", "bold":true, "color":"#8eedeb"}', Text3:'{"translate":"bingo.lobby.card_generation.random_card.sign.line3", "bold":true, "color":"#8eedeb"}', Text4:'{"translate":"bingo.lobby.card_generation.random_card.sign.line4", "bold":true, "color":"#8eedeb"}'} +setblock 1 65 -6 minecraft:warped_wall_sign[facing=west]{Text1: '{"translate":"bingo.lobby.card_generation.random_card.sign.line1", "bold":true, "color":"#8eedeb", "clickEvent":{"action":"run_command","value":"/tellraw @s[scores={bingo.settings=2}] [{\\"translate\\": \\"bingo.lobby.card_generation.from_seed.instructions\\", \\"with\\": [{\\"translate\\": \\"bingo.lobby.card_generation.from_seed.instructions.link\\", \\"color\\":\\"#00c3ff\\", \\"clickEvent\\": {\\"action\\": \\"suggest_command\\", \\"value\\": \\"/trigger bingo.seed set \\"}}]}, \\"\\n\\", {\\"translate\\": \\"bingo.lobby.card_generation.from_seed.explanation\\", \\"italic\\": true, \\"color\\": \\"gray\\"}]"}}', Text2:'{"translate":"bingo.lobby.card_generation.random_card.sign.line2", "bold":true, "color":"#8eedeb"}', Text3:'{"translate":"bingo.lobby.card_generation.random_card.sign.line3", "bold":true, "color":"#8eedeb"}', Text4:'{"translate":"bingo.lobby.card_generation.random_card.sign.line4", "bold":true, "color":"#8eedeb"}'} -setblock 7 65 2 minecraft:warped_wall_sign[facing=west]{Text1: '{"translate":"bingo.lobby.settings.player.tutorial.sign.line1", "bold":true, "color":"#8eedeb", "clickEvent":{"action":"run_command","value":"trigger bingo.settings set 3"}}', Text2:'{"translate":"bingo.lobby.settings.player.tutorial.sign.line2", "color":"#8eedeb"}', Text3:'{"translate":"bingo.lobby.settings.player.tutorial.sign.line3", "color":"#8eedeb"}', Text4:'{"translate":"bingo.lobby.settings.player.tutorial.sign.line4", "color":"#8eedeb"}'} +setblock 7 65 2 minecraft:warped_wall_sign[facing=west]{Text1: '{"translate":"bingo.lobby.settings.player.tutorial.sign.line1", "bold":true, "color":"#8eedeb", "clickEvent":{"action":"run_command","value":"/function bingo:lobby/player_settings/initialize_tutorial"}}', Text2:'{"translate":"bingo.lobby.settings.player.tutorial.sign.line2", "color":"#8eedeb"}', Text3:'{"translate":"bingo.lobby.settings.player.tutorial.sign.line3", "color":"#8eedeb"}', Text4:'{"translate":"bingo.lobby.settings.player.tutorial.sign.line4", "color":"#8eedeb"}'} -setblock 7 65 4 minecraft:warped_wall_sign[facing=west]{Text1: '{"translate":"bingo.lobby.settings.player.save.sign.line1", "bold":true, "color":"#8eedeb", "clickEvent":{"action":"run_command","value":"trigger bingo.settings set 4"}}', Text2:'{"translate":"bingo.lobby.settings.player.save.sign.line2", "color":"#8eedeb"}', Text3:'{"translate":"bingo.lobby.settings.player.save.sign.line3", "color":"#8eedeb"}', Text4:'{"translate":"bingo.lobby.settings.player.save.sign.line4", "color":"#8eedeb"}'} +setblock 7 65 4 minecraft:warped_wall_sign[facing=west]{Text1: '{"translate":"bingo.lobby.settings.player.save.sign.line1", "bold":true, "color":"#8eedeb", "clickEvent":{"action":"run_command","value":"/scoreboard players set @s bingo.menu_page 0"}}', Text2:'{"translate":"bingo.lobby.settings.player.save.sign.line2", "color":"#8eedeb"}', Text3:'{"translate":"bingo.lobby.settings.player.save.sign.line3", "color":"#8eedeb", "clickEvent":{"action":"run_command","value":"/function bingo:lobby/player_settings/save/print_dialog"}}', Text4:'{"translate":"bingo.lobby.settings.player.save.sign.line4", "color":"#8eedeb"}'} -setblock 7 65 6 minecraft:warped_wall_sign[facing=west]{Text1: '{"translate":"bingo.lobby.settings.player.load.sign.line1", "bold":true, "color":"#8eedeb", "clickEvent":{"action":"run_command","value":"trigger bingo.settings set 13"}}', Text2:'{"translate":"bingo.lobby.settings.player.load.sign.line2", "color":"#8eedeb"}', Text3:'{"translate":"bingo.lobby.settings.player.load.sign.line3", "color":"#8eedeb"}', Text4:'{"translate":"bingo.lobby.settings.player.load.sign.line4", "color":"#8eedeb"}'} +setblock 7 65 6 minecraft:warped_wall_sign[facing=west]{Text1: '{"translate":"bingo.lobby.settings.player.load.sign.line1", "bold":true, "color":"#8eedeb", "clickEvent":{"action":"run_command","value":"/scoreboard players set @s bingo.menu_page 0"}}', Text2:'{"translate":"bingo.lobby.settings.player.load.sign.line2", "color":"#8eedeb", "clickEvent":{"action":"run_command","value":"/function bingo:lobby/player_settings/load/print_dialog"}}', Text3:'{"translate":"bingo.lobby.settings.player.load.sign.line3", "color":"#8eedeb"}', Text4:'{"translate":"bingo.lobby.settings.player.load.sign.line4", "color":"#8eedeb"}'} -setblock 7 65 -2 minecraft:warped_wall_sign[facing=west]{Text1: '{"translate":"bingo.lobby.settings.preferences.sign.line1", "bold":true, "color":"#8eedeb", "clickEvent":{"action":"run_command","value":"trigger bingo.pref set 1"}}', Text2:'{"translate":"bingo.lobby.settings.preferences.sign.line2", "bold":true, "color":"#8eedeb"}', Text3:'{"translate":"bingo.lobby.settings.preferences.sign.line3", "bold":true, "color":"#8eedeb"}', Text4:'{"translate":"bingo.lobby.settings.preferences.sign.line4", "bold":true, "color":"#8eedeb"}'} +setblock 7 65 -2 minecraft:warped_wall_sign[facing=west]{Text1: '{"translate":"bingo.lobby.settings.preferences.sign.line1", "bold":true, "color":"#8eedeb", "clickEvent":{"action":"run_command","value":"/trigger bingo.pref set 1"}}', Text2:'{"translate":"bingo.lobby.settings.preferences.sign.line2", "bold":true, "color":"#8eedeb"}', Text3:'{"translate":"bingo.lobby.settings.preferences.sign.line3", "bold":true, "color":"#8eedeb"}', Text4:'{"translate":"bingo.lobby.settings.preferences.sign.line4", "bold":true, "color":"#8eedeb"}'} -setblock 7 65 -6 minecraft:warped_wall_sign[facing=west]{Text2: '{"text":"More Settings", "bold":true, "color":"#8eedeb", "clickEvent":{"action":"run_command", "value": "tellraw @s [{\\"text\\": \\"Do you want to change future settings? \\"}, {\\"text\\": \\"[Yes]\\", \\"color\\": \\"green\\", \\"clickEvent\\": {\\"action\\": \\"run_command\\", \\"value\\": \\"/tellraw @s {\\\\\\"text\\\\\\":\\\\\\"Error accessing the future. Please talk to your local time machine operator.\\\\\\", \\\\\\"obfuscated\\\\\\": true}\\"}}, {\\"text\\": \\" [No]\\", \\"color\\": \\"red\\", \\"clickEvent\\": {\\"action\\": \\"run_command\\", \\"value\\": \\"/tellraw @s {\\\\\\"text\\\\\\":\\\\\\"Good decision. Who knows, maybe these settings are awful.\\\\\\"}\\"}}]"}}', Text3:'{"text":"Comming Soon", "bold":true, "color":"#8eedeb"}'} \ No newline at end of file +setblock 7 65 -6 minecraft:warped_wall_sign[facing=west]{Text2: '{"text":"More Settings", "bold":true, "color":"#8eedeb", "clickEvent":{"action":"run_command", "value": "/tellraw @s [{\\"text\\": \\"Do you want to change future settings? \\"}, {\\"text\\": \\"[Yes]\\", \\"color\\": \\"green\\", \\"clickEvent\\": {\\"action\\": \\"run_command\\", \\"value\\": \\"/tellraw @s {\\\\\\"text\\\\\\":\\\\\\"Error accessing the future. Please talk to your local time machine operator.\\\\\\", \\\\\\"obfuscated\\\\\\": true}\\"}}, {\\"text\\": \\" [No]\\", \\"color\\": \\"red\\", \\"clickEvent\\": {\\"action\\": \\"run_command\\", \\"value\\": \\"/tellraw @s {\\\\\\"text\\\\\\":\\\\\\"Good decision. Who knows, maybe these settings are awful.\\\\\\"}\\"}}]"}}', Text3:'{"text":"Comming Soon", "bold":true, "color":"#8eedeb"}'} \ No newline at end of file diff --git a/data/bingo/functions/lobby/tick.mcfunction b/data/bingo/functions/lobby/tick.mcfunction index 1e580cab..1c5c6249 100644 --- a/data/bingo/functions/lobby/tick.mcfunction +++ b/data/bingo/functions/lobby/tick.mcfunction @@ -9,12 +9,7 @@ execute as @a[scores={bingo.pref=..-1}] run function bingo:preferences/show_pref execute as @a[scores={bingo.pref=1..}] run function bingo:preferences/show_preferences #change settings -execute if entity @a[limit=1, scores={bingo.settings=1}] run function bingo:card_generation/random_card -tellraw @a[limit=1, scores={bingo.settings=2}] [{"translate": "bingo.lobby.card_generation.from_seed.instructions", "with": [{"translate": "bingo.lobby.card_generation.from_seed.instructions.link", "color":"#00c3ff", "clickEvent": {"action": "suggest_command", "value": "/trigger bingo.seed set "}}]}, "\n", {"translate": "bingo.lobby.card_generation.from_seed.explanation", "italic": true, "color": "gray"}] -execute as @a[scores={bingo.settings=3}] run function bingo:lobby/player_settings/initialize_tutorial -execute as @a[scores={bingo.settings=4}] run function bingo:lobby/player_settings/save/print_first_page execute as @a[scores={bingo.settings=5..12}] run function bingo:lobby/player_settings/save/do_action -execute as @a[scores={bingo.settings=13}] run function bingo:lobby/player_settings/load/print_first_page execute as @a[scores={bingo.settings=14..20}] run function bingo:lobby/player_settings/load/do_action execute as @e[type=minecraft:item, nbt={Item:{id:"minecraft:name_tag", tag:{bingo:{newConfig: true}}}}] if data entity @s Item.tag.display.Name run function bingo:lobby/player_settings/save/new_config scoreboard players reset @a bingo.settings