diff --git a/data/craftytable/advancements/interrupt.json b/data/craftytable/advancements/interrupt.json new file mode 100644 index 0000000..c274384 --- /dev/null +++ b/data/craftytable/advancements/interrupt.json @@ -0,0 +1,28 @@ +{ + "display": { + "title": { + "text": "I have an idea...", + "color": "dark_green", + "bold": false, + "italic": true, + "underlined": false + }, + "description": { + "text": "Interrupt a meeting at the microphone", + "color": "dark_green" + }, + "icon": { + "item": "minecraft:lever" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "meetinginterrupt": { + "trigger": "minecraft:impossible" + } + }, + "parent": "craftytable:joinmeeting" +} \ No newline at end of file diff --git a/data/craftytable/advancements/interruptsmite.json b/data/craftytable/advancements/interruptsmite.json new file mode 100644 index 0000000..926ec77 --- /dev/null +++ b/data/craftytable/advancements/interruptsmite.json @@ -0,0 +1,26 @@ +{ + "display": { + "title": { + "text": "No stupid suggestions!", + "color": "dark_red", + "bold": true, + "underlined": true + }, + "description": { + "text": "Get smitten at the interruption microphone" + }, + "icon": { + "item": "minecraft:barrier" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": true + }, + "criteria": { + "meetingsmitten": { + "trigger": "minecraft:impossible" + } + }, + "parent": "craftytable:interrupt" +} \ No newline at end of file diff --git a/data/craftytable/advancements/joinmeeting.json b/data/craftytable/advancements/joinmeeting.json new file mode 100644 index 0000000..11c5e66 --- /dev/null +++ b/data/craftytable/advancements/joinmeeting.json @@ -0,0 +1,24 @@ +{ + "display": { + "title": { + "text": "Democracy!" + }, + "description": { + "text": "Join a meeting! Saturdays at 8 PM BST.", + "color": "dark_green" + }, + "icon": { + "item": "minecraft:paper" + }, + "frame": "goal", + "show_toast": true, + "announce_to_chat": true, + "hidden": false + }, + "criteria": { + "meetingjoin": { + "trigger": "minecraft:impossible" + } + }, + "parent": "craftytable:root" +} \ No newline at end of file diff --git a/data/craftytable/advancements/leavemeeting.json b/data/craftytable/advancements/leavemeeting.json new file mode 100644 index 0000000..a7c7984 --- /dev/null +++ b/data/craftytable/advancements/leavemeeting.json @@ -0,0 +1,28 @@ +{ + "display": { + "title": { + "text": "Adjourned!", + "color": "gold" + }, + "description": { + "text": "Reach the end of a meeting", + "color": "dark_green" + }, + "icon": { + "item": "minecraft:iron_axe" + }, + "frame": "goal", + "show_toast": true, + "announce_to_chat": true, + "hidden": false + }, + "criteria": { + "meetingend": { + "trigger": "minecraft:impossible" + } + }, + "rewards": { + "experience": 20 + }, + "parent": "craftytable:vote" +} \ No newline at end of file diff --git a/data/craftytable/advancements/order.json b/data/craftytable/advancements/order.json new file mode 100644 index 0000000..391f506 --- /dev/null +++ b/data/craftytable/advancements/order.json @@ -0,0 +1,27 @@ +{ + "display": { + "title": { + "text": "Embrace order!", + "color": "dark_green" + }, + "description": { + "text": "Your meeting is called to order" + }, + "icon": { + "item": "minecraft:anvil" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "meetingorder": { + "trigger": "minecraft:impossible" + } + }, + "rewards": { + "experience": 1 + }, + "parent": "craftytable:joinmeeting" +} \ No newline at end of file diff --git a/data/craftytable/advancements/root.json b/data/craftytable/advancements/root.json new file mode 100644 index 0000000..3c046bb --- /dev/null +++ b/data/craftytable/advancements/root.json @@ -0,0 +1,41 @@ +{ + "display": { + "title": { + "text": "The Crafty Table", + "color": "dark_green", + "bold": false + }, + "description": { + "text": "A server with many secrets!" + }, + "icon": { + "item": "minecraft:crafting_table" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false, + "background": "minecraft:textures/gui/advancements/backgrounds/stone.png" + }, + "criteria": { + "spawnloc": { + "trigger": "minecraft:location", + "conditions": { + "position": { + "x": { + "min": -2, + "max": 2 + }, + "y": { + "min": 72, + "max": 78 + }, + "z": { + "min": 78, + "max": 82 + } + } + } + } + } +} \ No newline at end of file diff --git a/data/craftytable/advancements/vote.json b/data/craftytable/advancements/vote.json new file mode 100644 index 0000000..f9d0381 --- /dev/null +++ b/data/craftytable/advancements/vote.json @@ -0,0 +1,28 @@ +{ + "display": { + "title": { + "text": "Participate in a vote", + "color": "gold" + }, + "description": { + "text": "Vote using the VoteBook during a meeting" + }, + "icon": { + "item": "minecraft:written_book" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "meetingvote": { + "trigger": "minecraft:impossible" + } + }, + "rewards": { + "experience": 5, + "function": "tctvote:ivoted" + }, + "parent": "craftytable:joinmeeting" +} \ No newline at end of file diff --git a/data/minecraft/tags/functions/load.json b/data/minecraft/tags/functions/load.json index 369dfbf..b614ef5 100644 --- a/data/minecraft/tags/functions/load.json +++ b/data/minecraft/tags/functions/load.json @@ -1 +1 @@ -{"values": ["tctvote:load"]} \ No newline at end of file +{"values": ["tctvote:load", "tctcoins:load"]} \ No newline at end of file diff --git a/data/tctcoins/functions/cointodia.mcfunction b/data/tctcoins/functions/cointodia.mcfunction new file mode 100644 index 0000000..4653cd8 --- /dev/null +++ b/data/tctcoins/functions/cointodia.mcfunction @@ -0,0 +1,19 @@ +# Add exchg2 tag for players within distance with 10 coins minimum +execute as @a[distance=..5] run execute store result score @s tokenCount run clear @s minecraft:sunflower{ctcb:"certified"} 0 +execute as @a[distance=..5] run execute if score @s tokenCount matches 10.. run tag @s add exchg2 + +# Save scores on monetary and player itself +execute as @a[tag=exchg2] run scoreboard players remove @e[type=minecraft:armor_stand,tag=monetary] diaStore 1 +execute as @a[tag=exchg2] run scoreboard players remove @e[type=minecraft:armor_stand,tag=monetary] tokenCirculation 10 +execute as @a[tag=exchg2] run scoreboard players add @s diaOuttake 1 + +# Clear coins and give diamond +execute as @a[tag=exchg2] run clear @s minecraft:sunflower{ctcb:"certified"} 10 +give @a[tag=exchg2] minecraft:diamond 1 + +# Notify using tellraw of the results +tellraw @a[tag=exchg2] ["",{"text":"CTCB Exchange >> ","bold":true,"color":"dark_green"},{"text":"Exchanged 10 CraftyCoins for 1 diamond.","color":"white"}] +tellraw @a[distance=..5,tag=!exchg2] ["",{"text":"CTCB Exchange >> ","bold":true,"color":"dark_green"},{"text":"Could not exchange. ","bold":true,"color":"dark_red"},{"text":"Not enough CraftyCoins in your inventory.","color":"white"}] + +# Remove exchange tag +tag @a[tag=exchg2] remove exchg2 \ No newline at end of file diff --git a/data/tctcoins/functions/diatocoin.mcfunction b/data/tctcoins/functions/diatocoin.mcfunction new file mode 100644 index 0000000..c4b0343 --- /dev/null +++ b/data/tctcoins/functions/diatocoin.mcfunction @@ -0,0 +1,19 @@ +# Add exchg1 tag for players within distance with 1 diamond minimum +execute as @a[distance=..5] run execute store result score @s diaCount run clear @s minecraft:diamond 0 +execute as @a[distance=..5] run execute if score @s diaCount matches 1.. run tag @s add exchg1 + +# Save scores on monetary and player itself +execute as @a[tag=exchg1] run scoreboard players add @e[type=minecraft:armor_stand,tag=monetary] diaStore 1 +execute as @a[tag=exchg1] run scoreboard players add @e[type=minecraft:armor_stand,tag=monetary] tokenCirculation 10 +execute as @a[tag=exchg1] run scoreboard players add @s tokenOuttake 10 + +# Clear diamond and give coins +execute as @a[tag=exchg1] run clear @s minecraft:diamond 1 +give @a[tag=exchg1] minecraft:sunflower{display: {Name: '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"white","text":"CraftyCoin"}],"text":""}', Lore: ['{"extra":[{"text":"Certified"}],"text":""}']}, ctcb: "certified"} 10 + +# Notify using tellraw of the results +tellraw @a[tag=exchg1] ["",{"text":"CTCB Exchange >> ","bold":true,"color":"dark_green"},{"text":"Exchanged 1 diamond for 10 CraftyCoins.","color":"white"}] +tellraw @a[distance=..5,tag=!exchg1] ["",{"text":"CTCB Exchange >> ","bold":true,"color":"dark_green"},{"text":"Could not exchange. ","bold":true,"color":"dark_red"},{"text":"Not enough diamonds in your inventory.","color":"white"}] + +# Remove exchange tag +tag @a[tag=exchg1] remove exchg1 \ No newline at end of file diff --git a/data/tctcoins/functions/load.mcfunction b/data/tctcoins/functions/load.mcfunction new file mode 100644 index 0000000..4bca860 --- /dev/null +++ b/data/tctcoins/functions/load.mcfunction @@ -0,0 +1,7 @@ +scoreboard objectives add tokenCirculation dummy +scoreboard objectives add tokenOuttake dummy +scoreboard objectives add tokenCount dummy +scoreboard objectives add diaCount dummy +scoreboard objectives add diaStore dummy +scoreboard objectives add diaOuttake dummy +execute unless entity @e[type=minecraft:armor_stand,tag=monetary] run summon minecraft:armor_stand 0 90 0 {CustomNameVisible:0b,NoGravity:1b,Silent:1b,Invulnerable:1b,ShowArms:0b,Small:1b,Marker:1b,Invisible:1b,NoBasePlate:1b,PersistenceRequired:1b,Tags:["monetary"]} \ No newline at end of file diff --git a/data/tctvote/functions/calc.mcfunction b/data/tctvote/functions/calc.mcfunction index 3c44211..9f340f6 100644 --- a/data/tctvote/functions/calc.mcfunction +++ b/data/tctvote/functions/calc.mcfunction @@ -1,4 +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 \ No newline at end of file +execute as @a[scores={mt_vote_trigger=1..}] run clear @s written_book{certified:votebook} 1 +execute as @a[scores={mt_vote_trigger=1..}] run scoreboard players reset @s mt_vote_trigger \ No newline at end of file diff --git a/data/tctvote/functions/decrease.mcfunction b/data/tctvote/functions/decrease.mcfunction index 504174a..f240864 100644 --- a/data/tctvote/functions/decrease.mcfunction +++ b/data/tctvote/functions/decrease.mcfunction @@ -1,3 +1,4 @@ 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 \ No newline at end of file +execute at @e[type=minecraft:armor_stand,tag=mt_votestand,limit=1] run playsound minecraft:block.note_block.hat master @a ~ ~ ~ 100 1 +schedule function tctvote:tock 10t append \ No newline at end of file diff --git a/data/tctvote/functions/interrupt.mcfunction b/data/tctvote/functions/interrupt.mcfunction new file mode 100644 index 0000000..05a10ff --- /dev/null +++ b/data/tctvote/functions/interrupt.mcfunction @@ -0,0 +1,2 @@ +execute at @p[] run tellraw @a[distance=..30] ["",{"text":"The Council >> ","bold":true,"color":"dark_green"},{"selector":"@p","bold":true,"color":"yellow"},{"text":" requests the floor.","bold":true,"color":"white"}] +execute as @p run advancement grant @s[advancements={craftytable:joinmeeting=true}] only craftytable:interrupt \ No newline at end of file diff --git a/data/tctvote/functions/ivoted.mcfunction b/data/tctvote/functions/ivoted.mcfunction new file mode 100644 index 0000000..e69de29 diff --git a/data/tctvote/functions/loudorder.mcfunction b/data/tctvote/functions/loudorder.mcfunction new file mode 100644 index 0000000..06d101b --- /dev/null +++ b/data/tctvote/functions/loudorder.mcfunction @@ -0,0 +1,4 @@ +playsound minecraft:block.anvil.land master @a ~ ~ ~ 100 0.5 +execute as @a run playsound minecraft:entity.wither.spawn master @p ~ ~ ~ 100 0.54 +tellraw @a ["",{"text":"The Council >> ","bold":true,"color":"dark_green"},{"text":"ORDER IN THE ","bold":true,"color":"yellow"},{"text":"COUNCIL","bold":true,"underlined":true,"color":"dark_red"}] +advancement grant @a[advancements={craftytable:joinmeeting=true},distance=..30] only craftytable:order \ No newline at end of file diff --git a/data/tctvote/functions/meetingclose.mcfunction b/data/tctvote/functions/meetingclose.mcfunction new file mode 100644 index 0000000..862b2a2 --- /dev/null +++ b/data/tctvote/functions/meetingclose.mcfunction @@ -0,0 +1,3 @@ +tellraw @a[] ["",{"text":"The Council >> ","bold":true,"color":"dark_green"},{"text":"Meeting adjourned!","bold":true,"color":"white"}] +advancement grant @a[advancements={craftytable:joinmeeting=true},distance=..30] only craftytable:leavemeeting +playsound minecraft:block.anvil.land master @a ~ ~ ~ 100 0.5 \ No newline at end of file diff --git a/data/tctvote/functions/meetingopen.mcfunction b/data/tctvote/functions/meetingopen.mcfunction new file mode 100644 index 0000000..e4af4b2 --- /dev/null +++ b/data/tctvote/functions/meetingopen.mcfunction @@ -0,0 +1,4 @@ +tellraw @a[] ["",{"text":"The Council >> ","bold":true,"color":"dark_green"},{"text":"Meeting is now in session!","bold":true,"color":"white"}] +tellraw @a[distance=..30] ["",{"text":"The Council >> ","bold":true,"color":"dark_green"},{"text":"Present members: ","bold":true,"color":"white"},{"selector":"@a[distance=..30]","italic":true,"color":"yellow"}] +advancement grant @a[distance=..30] until craftytable:joinmeeting +playsound minecraft:block.anvil.land master @a ~ ~ ~ 100 0.5 \ No newline at end of file diff --git a/data/tctvote/functions/order.mcfunction b/data/tctvote/functions/order.mcfunction new file mode 100644 index 0000000..a5edda2 --- /dev/null +++ b/data/tctvote/functions/order.mcfunction @@ -0,0 +1 @@ +playsound minecraft:block.anvil.land master @a ~ ~ ~ 100 0.5 \ No newline at end of file diff --git a/data/tctvote/functions/prepare.mcfunction b/data/tctvote/functions/prepare.mcfunction index 55d952d..af9c0e8 100644 --- a/data/tctvote/functions/prepare.mcfunction +++ b/data/tctvote/functions/prepare.mcfunction @@ -21,7 +21,7 @@ summon minecraft:armor_stand ~ ~ ~ {NoGravity:1b,Invulnerable:1b,Small:1b,Marker 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"}] +tellraw @a[scores={mt_vote_eligible=1}] ["",{"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 @@ -38,4 +38,7 @@ schedule function tctvote:notes/up_0 1t function tctvote:countdownstart # And start the countdown -schedule function tctvote:halt 20s \ No newline at end of file +schedule function tctvote:halt 20s + +# Give everyone advancements +advancement grant @a[scores={mt_vote_eligible=1},advancements={craftytable:joinmeeting=true}] only craftytable:vote \ No newline at end of file diff --git a/data/tctvote/functions/tick.mcfunction b/data/tctvote/functions/tick.mcfunction index f96b8dd..96a36c1 100644 --- a/data/tctvote/functions/tick.mcfunction +++ b/data/tctvote/functions/tick.mcfunction @@ -1 +1 @@ -execute as @a[scores={mt_vote_trigger=1..2}] run function tctvote:calc \ No newline at end of file +execute as @a[scores={mt_vote_trigger=1..}] run function tctvote:calc \ No newline at end of file diff --git a/data/tctvote/functions/tock.mcfunction b/data/tctvote/functions/tock.mcfunction new file mode 100644 index 0000000..895f3c2 --- /dev/null +++ b/data/tctvote/functions/tock.mcfunction @@ -0,0 +1 @@ +execute at @e[type=minecraft:armor_stand,tag=mt_votestand,limit=1] run playsound minecraft:block.note_block.hat master @a ~ ~ ~ 100 0.8 \ No newline at end of file