Skip to content

Commit

Permalink
Fix issue #2: Orb of servitude exploit.
Browse files Browse the repository at this point in the history
  • Loading branch information
slicedlime committed Mar 28, 2019
1 parent 9fa93bb commit 1fc1091
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
22 changes: 22 additions & 0 deletions datapacks/Chosen/data/praise/functions/accept_sacrifice.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Show particles

execute at @e[tag=Main] run particle happy_villager ~ ~-0.2 ~ 0.2 0.75 0.2 0 5
execute at @e[tag=Main] run particle smoke ~ ~-0.2 ~ 0.4 0.5 0.4 0 10

# Reduce the number of sacrifices remaining
scoreboard players operation @e[tag=CurrentTeam] Sacrifice -= @s Sacrifice
execute if entity @e[tag=CurrentTeam,scores={Sacrifice=0..}] run kill @s

# Manage remaining items on altar
scoreboard players operation @s Sacrifice = @e[tag=CurrentTeam] Sacrifice
scoreboard players operation @s Sacrifice *= -1 Const

execute store result entity @s Item.Count byte 1 run scoreboard players get @s Sacrifice

execute if entity @e[tag=CurrentTeam,scores={Sacrifice=..0}] run summon minecraft:item ~ ~2 ~ {"Item":{"id":"minecraft:ender_pearl","Count":1b,tag:{display:{Name:"{\"text\":\"Orb of Servitude\",\"color\":\"blue\"}",Lore:["A token of recognition"]}}}}
execute if entity @e[tag=CurrentTeam,scores={Sacrifice=..0}] run title @a[tag=OnTeam] title [{"text":"The Gods are pleased"}]
execute if entity @e[tag=CurrentTeam,scores={Sacrifice=..0}] run title @a[tag=OnTeam] subtitle [{"text":"... for now"}]
execute if entity @e[tag=CurrentTeam,scores={Sacrifice=..0}] run title @a[tag=OnTeam] actionbar [{"text":""}]
execute if entity @e[tag=CurrentTeam,scores={Sacrifice=..0}] run tellraw @a [{"text":"The Gods have accepted the sacrifices of "},{"selector":"@e[tag=CurrentTeam]"},{"text":"."}]

scoreboard players reset @e[scores={Sacrifice=..0}] Sacrifice
27 changes: 4 additions & 23 deletions datapacks/Chosen/data/praise/functions/sacrificeitem.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

execute store result score @s Sacrifice run data get entity @s Item.Count

# Accept the sacrifice

execute at @e[tag=Main] run particle happy_villager ~ ~-0.2 ~ 0.2 0.75 0.2 0 5
execute at @e[tag=Main] run particle smoke ~ ~-0.2 ~ 0.4 0.5 0.4 0 10

tag @e[tag=CurrentTeam] remove CurrentTeam
execute if entity @s[tag=chosen] run tag @e[tag=Chosen] add CurrentTeam
execute if entity @s[tag=servants] run tag @e[tag=Servants] add CurrentTeam
Expand All @@ -19,25 +14,11 @@ execute if entity @s[tag=believers] run tag @e[tag=Believers] add CurrentTeam

execute as @e[tag=CurrentTeam] run function praise:tag_team

# Reduce the number of sacrifices remaining
scoreboard players operation @e[tag=CurrentTeam] Sacrifice -= @s Sacrifice
execute if entity @e[tag=CurrentTeam,scores={Sacrifice=0..}] run kill @s

# Manage remaining items on altar
scoreboard players operation @s Sacrifice = @e[tag=CurrentTeam] Sacrifice
scoreboard players operation @s Sacrifice *= -1 Const

execute store result entity @s Item.Count byte 1 run scoreboard players get @s Sacrifice

execute if entity @e[tag=CurrentTeam,scores={Sacrifice=..0}] run summon minecraft:item ~ ~2 ~ {"Item":{"id":"minecraft:ender_pearl","Count":1b,tag:{display:{Name:"{\"text\":\"Orb of Servitude\",\"color\":\"blue\"}",Lore:["A token of recognition"]}}}}
execute if entity @e[tag=CurrentTeam,scores={Sacrifice=..0}] run title @a[tag=OnTeam] title [{"text":"The Gods are pleased"}]
execute if entity @e[tag=CurrentTeam,scores={Sacrifice=..0}] run title @a[tag=OnTeam] subtitle [{"text":"... for now"}]
execute if entity @e[tag=CurrentTeam,scores={Sacrifice=..0}] run title @a[tag=OnTeam] actionbar [{"text":""}]
execute if entity @e[tag=CurrentTeam,scores={Sacrifice=..0}] run tellraw @a [{"text":"The Gods have accepted the sacrifices of "},{"selector":"@e[tag=CurrentTeam]"},{"text":"."}]
# Accept the sacrifice
execute if score @e[tag=CurrentTeam,limit=1] Sacrifice matches 1.. run function praise:accept_sacrifice

tag @s remove Accepted
scoreboard players reset @e[scores={Sacrifice=..0}] Sacrifice
scoreboard players reset @s Sacrifice

tag @s remove Accepted
tag @e[tag=CurrentTeam] remove CurrentTeam
tag @a remove OnTeam
tag @a remove OnTeam

0 comments on commit 1fc1091

Please sign in to comment.