Player using book to 'cast' click on a score command targeting themselves does not work on half slabs. More correctly updating score with book fails between elevation of [email protected]@.56 (y@=full number in the y axis).
Have tested this bug as far back as the chain and repeat command blocks were added and always fails.
Below are commands to replicate:
Book:
/give @p written_book 1 0 {pages:["[\"\",{\"text\":\"Bug testing \",\"color\":\"dark_blue\",\"bold\":true},{\"text\":\"\n\",\"color\":\"none\",\"bold\":false},{\"text\":\"Test \\\"Click Cast\\\" below on half slabs. \",\"color\":\"dark_green\"},{\"text\":\"\n\",\"color\":\"none\"},{\"text\":\"Click Cast\",\"color\":\"light_purple\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/scoreboard players set @p[score_mana_min=2,r=0] CAST 1\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"expect text \\\"Cast test successful.\\\"\",\"color\":\"red\"}]}}}]"],title:Halfslab Book Bug Test,author:RCvie}Objectives:
/scoreboard objectives add mana dummy
/scoreboard objectives add CAST dummyMana score:
/scoreboard players set @p mana 100
/scoreboard objectives setdisplay sidebar manaCommand Block chain on repeat:
/execute @a[score_mana_min=2] ~ ~ ~ /scoreboard players remove @p[score_CAST_min=1,r=0] mana 2
/execute @a[score_CAST_min=1] ~ ~ ~ /say @p Cast test successful.
/scoreboard players set @a[score_CAST_min=1] CAST 0
Duplicate of MC-13526.
As a side-note, you'll find issues regardless. When the player runs a command via a clickEvent in a book (and from
/tellraw), they are running the command as if they have typed it in the chat themselves. This means they are subject to standard chat limits, being a 100-character limit, required "/" to run commands, and most importantly the requirement of being OP'd to run OP-only commands (being/scoreboard).You should use a command like
/triggerinstead, which allows non-OP's to use the book and also circumvents your issue as it can only target the player running/trigger, and thus no radius issues are present.You should also not be using
/executein that manner. Firstly, you should only use it when the sender or origin needs to be changed. Since/scoreboardhas a target selector, you should use that target selector instead. You can have multiplescoreparameters if they're checking different objectives.Secondly, you should not mix an executor of
@awith a nested@p.@ais the only selector that can target dead players (as long as radius is not defined). If a player dies, the/executecommand will still cause them to run/scoreboard, but they will target the nearest-living player to their body instead of themselves.r=0is only a band-aid fix because it will still target players that are standing at the same location.The fix is to use similar selectors and sender bias. If
c=1is used (in situations where player bias does not apply, which does happen to be with/scoreboard), the entity running the command will always target themselves so long as they match the other parameters. Use@aas the executor and@a[c=1]as the nested selector, or@e[type=Player]as the executor and@pas the nested selector.r=0is not needed. For entities, player bias can be circumvented by removing players from selection (@e[type=!Player]with@e[type=!Player,c=1]).The nested selector fix is not needed though since
/executecan be removed entirely: