Bunch of changes, adding functionality requested.

- Added bunch of achievements for democracy
- Added currency exchanges
- Made voting algorithm more efficient
- Added standard meeting hall functionality to the datapack
This commit is contained in:
Abel Hoogeveen 2021-08-06 01:05:38 +02:00
parent 02ca44bb99
commit aff958e612
Signed by: abelhooge
GPG Key ID: C540221690CBFFBA
22 changed files with 273 additions and 7 deletions

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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
}
}
}
}
}
}

View File

@ -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"
}

View File

@ -1 +1 @@
{"values": ["tctvote:load"]}
{"values": ["tctvote:load", "tctcoins:load"]}

View File

@ -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

View File

@ -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

View File

@ -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"]}

View File

@ -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
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

View File

@ -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
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

View File

@ -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

View File

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1 @@
playsound minecraft:block.anvil.land master @a ~ ~ ~ 100 0.5

View File

@ -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
schedule function tctvote:halt 20s
# Give everyone advancements
advancement grant @a[scores={mt_vote_eligible=1},advancements={craftytable:joinmeeting=true}] only craftytable:vote

View File

@ -1 +1 @@
execute as @a[scores={mt_vote_trigger=1..2}] run function tctvote:calc
execute as @a[scores={mt_vote_trigger=1..}] run function tctvote:calc

View File

@ -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