TCT-Datapack/data/tct/functions/vote_nonlive.mcfunction

38 lines
2.2 KiB
Mcfunction

tellraw @a ["",{"text":"Vote >>","bold":true,"color":"dark_green"},{"text":" Vote using the voting book now!","bold":true,"color":"white"}]
scoreboard players reset * mt_vote_balance
scoreboard players reset * mt_vote_trigger
scoreboard players enable @a[tag=eligible] mt_vote_trigger
give @a[tag=eligible] minecraft:written_book{display:{Name:'{"text":"Voting Book","color":"white","bold":true}',Lore:['{"text":"Cast your vote now!"}']},certified:votebook,title:"Voting Book",author:"Kipje",pages:['[{"text":"Cast your vote!\\n Click AYE or NO below.\\n\\n\\n"},{"text":"AYE","color":"dark_green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"Click to vote AYE on this vote."}]},"clickEvent":{"action":"run_command","value":"/trigger mt_vote_trigger set 1"}},{"text":" | "},{"text":"NO","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"Click to vote NO on this vote."}]},"clickEvent":{"action":"run_command","value":"/trigger mt_vote_trigger set 2"}}]']} 1
team add green "Green"
team modify green color dark_green
team add red "Red"
team modify red color red
team add yellow "Yellow"
team modify yellow color yellow
team join green AYE
team join red NO
team join yellow Remaining
scoreboard players set AYE mt_vote_balance 0
scoreboard players set NO mt_vote_balance 0
scoreboard players set Remaining mt_vote_balance 20
schedule function tct:notes/up_0 5t
schedule function tct:decrease 1s append
schedule function tct:decrease 2s append
schedule function tct:decrease 3s append
schedule function tct:decrease 4s append
schedule function tct:decrease 5s append
schedule function tct:decrease 6s append
schedule function tct:decrease 7s append
schedule function tct:decrease 8s append
schedule function tct:decrease 9s append
schedule function tct:decrease 10s append
schedule function tct:decrease 11s append
schedule function tct:decrease 12s append
schedule function tct:decrease 13s append
schedule function tct:decrease 14s append
schedule function tct:decrease 15s append
schedule function tct:decrease 16s append
schedule function tct:decrease 17s append
schedule function tct:decrease 18s append
schedule function tct:decrease 19s append
schedule function tct:halt 20s