- Added bossbar to vote
- Changed vote to require eligibility score instead of tag - Performance optimizations - Sounds now play from an armor stand summoned at the vote button - Anonymous function works properly now
This commit is contained in:
parent
b05ad4a0e3
commit
02ca44bb99
|
@ -1 +1 @@
|
||||||
{"values": ["tct:load"]}
|
{"values": ["tctvote:load"]}
|
|
@ -1 +1 @@
|
||||||
{"values": ["tct:tick"]}
|
{"values": ["tctvote:tick"]}
|
|
@ -1,2 +0,0 @@
|
||||||
scoreboard players add AYE mt_vote_balance 1
|
|
||||||
playsound minecraft:block.note_block.pling master @a ~ ~ ~ 100 2
|
|
|
@ -1,4 +0,0 @@
|
||||||
execute as @a[scores={mt_vote_trigger=1}] run function tct:ayevote
|
|
||||||
execute as @a[scores={mt_vote_trigger=2}] run function tct:novote
|
|
||||||
execute as @a[scores={mt_vote_trigger=1..2}] run clear @s written_book{certified:votebook} 1
|
|
||||||
execute as @a[scores={mt_vote_trigger=1..2}] run scoreboard players reset @s mt_vote_trigger
|
|
|
@ -1 +0,0 @@
|
||||||
scoreboard players remove Remaining mt_vote_balance 1
|
|
|
@ -1,2 +0,0 @@
|
||||||
scoreboard objectives add mt_vote_balance dummy "Vote results"
|
|
||||||
scoreboard objectives add mt_vote_trigger trigger
|
|
|
@ -1,2 +0,0 @@
|
||||||
playsound minecraft:block.note_block.pling master @a ~ ~ ~ 100 1.6
|
|
||||||
schedule function tct:notes/down_1 5t
|
|
|
@ -1,2 +0,0 @@
|
||||||
playsound minecraft:block.note_block.pling master @a ~ ~ ~ 100 1.2
|
|
||||||
schedule function tct:notes/down_2 5t
|
|
|
@ -1 +0,0 @@
|
||||||
playsound minecraft:block.note_block.pling master @a ~ ~ ~ 100 0.8
|
|
|
@ -1,2 +0,0 @@
|
||||||
playsound minecraft:block.note_block.pling master @a ~ ~ ~ 100 0.8
|
|
||||||
schedule function tct:notes/up_1 5t
|
|
|
@ -1,2 +0,0 @@
|
||||||
playsound minecraft:block.note_block.pling master @a ~ ~ ~ 100 1.0
|
|
||||||
schedule function tct:notes/up_2 5t
|
|
|
@ -1 +0,0 @@
|
||||||
playsound minecraft:block.note_block.pling master @a ~ ~ ~ 100 1.6
|
|
|
@ -1,2 +0,0 @@
|
||||||
scoreboard players add NO mt_vote_balance 1
|
|
||||||
playsound minecraft:block.note_block.pling master @a ~ ~ ~ 100 1.6
|
|
|
@ -1 +0,0 @@
|
||||||
execute as @a[scores={mt_vote_trigger=1..2}] run function tct:calc
|
|
|
@ -1,39 +0,0 @@
|
||||||
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
|
|
||||||
scoreboard objectives setdisplay sidebar mt_vote_balance
|
|
||||||
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
|
|
|
@ -1,38 +0,0 @@
|
||||||
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
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
scoreboard players add AYE mt_vote_balance 1
|
||||||
|
execute if score @e[tag=mt_votestand,limit=1] mt_vote_anon matches 0 run execute at @e[type=minecraft:armor_stand,tag=mt_votestand,limit=1] run playsound minecraft:block.note_block.pling master @a ~ ~ ~ 100 2
|
|
@ -0,0 +1,4 @@
|
||||||
|
execute as @a[scores={mt_vote_trigger=1}] run function tctvote:ayevote
|
||||||
|
execute as @a[scores={mt_vote_trigger=2}] run function tctvote:novote
|
||||||
|
execute as @a[scores={mt_vote_trigger=1..2}] run clear @s written_book{certified:votebook} 1
|
||||||
|
execute as @a[scores={mt_vote_trigger=1..2}] run scoreboard players reset @s mt_vote_trigger
|
|
@ -0,0 +1,20 @@
|
||||||
|
schedule function tctvote:decrease 1s append
|
||||||
|
schedule function tctvote:decrease 2s append
|
||||||
|
schedule function tctvote:decrease 3s append
|
||||||
|
schedule function tctvote:decrease 4s append
|
||||||
|
schedule function tctvote:decrease 5s append
|
||||||
|
schedule function tctvote:decrease 6s append
|
||||||
|
schedule function tctvote:decrease 7s append
|
||||||
|
schedule function tctvote:decrease 8s append
|
||||||
|
schedule function tctvote:decrease 9s append
|
||||||
|
schedule function tctvote:decrease 10s append
|
||||||
|
schedule function tctvote:decrease 11s append
|
||||||
|
schedule function tctvote:decrease 12s append
|
||||||
|
schedule function tctvote:decrease 13s append
|
||||||
|
schedule function tctvote:decrease 14s append
|
||||||
|
schedule function tctvote:decrease 15s append
|
||||||
|
schedule function tctvote:shift 15s append
|
||||||
|
schedule function tctvote:decrease 16s append
|
||||||
|
schedule function tctvote:decrease 17s append
|
||||||
|
schedule function tctvote:decrease 18s append
|
||||||
|
schedule function tctvote:decrease 19s append
|
|
@ -0,0 +1,3 @@
|
||||||
|
scoreboard players remove @e[tag=mt_votestand] mt_countdown 1
|
||||||
|
execute store result bossbar minecraft:votetimer value run scoreboard players get @e[tag=mt_votestand,limit=1] mt_countdown
|
||||||
|
execute at @e[type=minecraft:armor_stand,tag=mt_votestand,limit=1] run playsound minecraft:block.note_block.hat master @a ~ ~ ~ 100 1
|
|
@ -1,10 +1,20 @@
|
||||||
|
# Remove the scoreboard from the sidebar
|
||||||
scoreboard objectives setdisplay sidebar
|
scoreboard objectives setdisplay sidebar
|
||||||
scoreboard players reset Remaining mt_vote_balance
|
|
||||||
|
# Remove all VoteBooks
|
||||||
execute as @a run clear @s written_book{certified:votebook}
|
execute as @a run clear @s written_book{certified:votebook}
|
||||||
|
|
||||||
|
# Report the results
|
||||||
tellraw @a ["",{"text":"Vote >>","bold":true,"color":"dark_green"},{"text":" AYES: ","bold":true,"color":"dark_green"},{"score":{"name":"AYE","objective":"mt_vote_balance"},"bold":true,"color":"white"},{"text":" "},{"text":" NOES: ","bold":true,"color":"red"},{"score":{"name":"NO","objective":"mt_vote_balance"},"bold":true,"color":"white"}]
|
tellraw @a ["",{"text":"Vote >>","bold":true,"color":"dark_green"},{"text":" AYES: ","bold":true,"color":"dark_green"},{"score":{"name":"AYE","objective":"mt_vote_balance"},"bold":true,"color":"white"},{"text":" "},{"text":" NOES: ","bold":true,"color":"red"},{"score":{"name":"NO","objective":"mt_vote_balance"},"bold":true,"color":"white"}]
|
||||||
scoreboard players reset * mt_vote_balance
|
|
||||||
scoreboard players reset * mt_vote_trigger
|
# play the stop sound
|
||||||
|
schedule function tctvote:notes/down_0 1t
|
||||||
|
|
||||||
|
# Remove the scores and teams
|
||||||
|
scoreboard objectives remove mt_vote_balance
|
||||||
|
scoreboard objectives remove mt_vote_trigger
|
||||||
|
scoreboard objectives remove mt_vote_anon
|
||||||
|
scoreboard objectives remove mt_countdown
|
||||||
|
bossbar remove votetimer
|
||||||
team remove green
|
team remove green
|
||||||
team remove red
|
team remove red
|
||||||
team remove yellow
|
|
||||||
schedule function tct:notes/down_0 1t
|
|
|
@ -0,0 +1 @@
|
||||||
|
scoreboard objectives add mt_vote_eligible dummy
|
|
@ -0,0 +1,2 @@
|
||||||
|
execute at @e[type=minecraft:armor_stand,tag=mt_votestand,limit=1] run playsound minecraft:block.note_block.pling master @a ~ ~ ~ 100 1.6
|
||||||
|
schedule function tctvote:notes/down_1 5t
|
|
@ -0,0 +1,2 @@
|
||||||
|
execute at @e[type=minecraft:armor_stand,tag=mt_votestand,limit=1] run playsound minecraft:block.note_block.pling master @a ~ ~ ~ 100 1.2
|
||||||
|
schedule function tctvote:notes/down_2 5t
|
|
@ -0,0 +1,2 @@
|
||||||
|
execute at @e[type=minecraft:armor_stand,tag=mt_votestand,limit=1] run playsound minecraft:block.note_block.pling master @a ~ ~ ~ 100 0.8
|
||||||
|
kill @e[type=minecraft:armor_stand,tag=mt_votestand]
|
|
@ -0,0 +1,2 @@
|
||||||
|
execute at @e[type=minecraft:armor_stand,tag=mt_votestand,limit=1] run playsound minecraft:block.note_block.pling master @a ~ ~ ~ 100 0.8
|
||||||
|
schedule function tctvote:notes/up_1 5t
|
|
@ -0,0 +1,2 @@
|
||||||
|
execute at @e[type=minecraft:armor_stand,tag=mt_votestand,limit=1] run playsound minecraft:block.note_block.pling master @a ~ ~ ~ 100 1.0
|
||||||
|
schedule function tctvote:notes/up_2 5t
|
|
@ -0,0 +1 @@
|
||||||
|
execute at @e[type=minecraft:armor_stand,tag=mt_votestand,limit=1] run playsound minecraft:block.note_block.pling master @a ~ ~ ~ 100 1.6
|
|
@ -0,0 +1,2 @@
|
||||||
|
scoreboard players add NO mt_vote_balance 1
|
||||||
|
execute if score @e[tag=mt_votestand,limit=1] mt_vote_anon matches 0 run execute at @e[type=minecraft:armor_stand,tag=mt_votestand,limit=1] run playsound minecraft:block.note_block.pling master @a ~ ~ ~ 100 1.6
|
|
@ -0,0 +1,41 @@
|
||||||
|
# Create scores, and teams
|
||||||
|
scoreboard objectives add mt_vote_balance dummy "Vote results"
|
||||||
|
scoreboard objectives add mt_vote_trigger trigger
|
||||||
|
scoreboard objectives add mt_vote_anon dummy
|
||||||
|
scoreboard objectives add mt_countdown dummy
|
||||||
|
bossbar add minecraft:votetimer "Vote time remaining"
|
||||||
|
bossbar set minecraft:votetimer max 20
|
||||||
|
bossbar set minecraft:votetimer style notched_20
|
||||||
|
bossbar set minecraft:votetimer color green
|
||||||
|
bossbar set minecraft:votetimer value 20
|
||||||
|
bossbar set minecraft:votetimer players @a
|
||||||
|
team add green "Green"
|
||||||
|
team modify green color dark_green
|
||||||
|
team add red "Red"
|
||||||
|
team modify red color red
|
||||||
|
team join green AYE
|
||||||
|
team join red NO
|
||||||
|
|
||||||
|
# Summon the VoteStand
|
||||||
|
summon minecraft:armor_stand ~ ~ ~ {NoGravity:1b,Invulnerable:1b,Small:1b,Marker:1b,Invisible:1b,Tags:["mt_votestand"]}
|
||||||
|
scoreboard players set @e[tag=mt_votestand] mt_countdown 20
|
||||||
|
|
||||||
|
# Announce the vote
|
||||||
|
tellraw @a ["",{"text":"Vote >>","bold":true,"color":"dark_green"},{"text":" Vote using the voting book now!","bold":true,"color":"white"}]
|
||||||
|
|
||||||
|
# Enable the trigger
|
||||||
|
scoreboard players enable @a[scores={mt_vote_eligible=1}] mt_vote_trigger
|
||||||
|
|
||||||
|
# Give the VoteBook
|
||||||
|
give @a[scores={mt_vote_eligible=1}] 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
|
||||||
|
|
||||||
|
# Reset the scores
|
||||||
|
scoreboard players set AYE mt_vote_balance 0
|
||||||
|
scoreboard players set NO mt_vote_balance 0
|
||||||
|
|
||||||
|
# Schedule the notes and countdown
|
||||||
|
schedule function tctvote:notes/up_0 1t
|
||||||
|
function tctvote:countdownstart
|
||||||
|
|
||||||
|
# And start the countdown
|
||||||
|
schedule function tctvote:halt 20s
|
|
@ -0,0 +1 @@
|
||||||
|
bossbar set minecraft:votetimer color red
|
|
@ -0,0 +1 @@
|
||||||
|
execute as @a[scores={mt_vote_trigger=1..2}] run function tctvote:calc
|
|
@ -0,0 +1,3 @@
|
||||||
|
function tctvote:prepare
|
||||||
|
scoreboard objectives setdisplay sidebar mt_vote_balance
|
||||||
|
scoreboard players set @e[tag=mt_votestand] mt_vote_anon 0
|
|
@ -0,0 +1,2 @@
|
||||||
|
function tctvote:prepare
|
||||||
|
scoreboard players set @e[tag=mt_votestand] mt_vote_anon 1
|
Loading…
Reference in New Issue