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:
2021-08-06 01:05:38 +02:00
parent 02ca44bb99
commit aff958e612
22 changed files with 273 additions and 7 deletions

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