1
I'm trying to give myself a book that contains a purchase menu, where each item has a clickable text that runs a function. However, if the book contains more than one element with a function, the item is simply not given. I don't receive any error messages, but the book doesn't appear in my inventory either. The command I'm using is:
/give @s minecraft:written_book{pages:[
"{\"text\":\"Pistol: TTI G34 - 500$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_tti_g34\"}}",
"{\"text\":\"Pistol: TEC-9 - 800$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_tec9\"}}",
"{\"text\":\"Pistol: Colt Python - 900$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_colt_python\"}}",
"{\"text\":\"Pistol: Sawed-Off - 700$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_sawed_off\"}}",
"{\"text\":\"Submachine Gun: UZI - 1200$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_uzi\"}}",
"{\"text\":\"Submachine Gun: MP5A5 - 1500$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_mp5a5\"}}",
"{\"text\":\"Submachine Gun: PP19 - 1500$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_pp19\"}}",
"{\"text\":\"Submachine Gun: UDP9 - 2100$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_udp9\"}}",
"{\"text\":\"Rifle: AK-47 - 2700$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_ak47\"}}",
"{\"text\":\"Rifle: M4A1 - 2700$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_m4a1\"}}",
"{\"text\":\"Rifle: MK-47 MUTANT - 2800$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_mk47_mutant\"}}",
"{\"text\":\"Rifle: MARLIN 1895 - 2100$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_marlin_1895\"}}",
"{\"text\":\"Rifle: SKS - 3200$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_sks\"}}",
"{\"text\":\"Rifle: M24 - 4200$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_m24\"}}",
"{\"text\":\"Grenade: Flashbang(Default) - 300$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_flash_grenade\"}}",
"{\"text\":\"Grenade: Flashbang(Impact) - 600$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_flashbang_grenade\"}}",
"{\"text\":\"Grenade: Smoke - 350$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_smoke_grenade\"}}",
"{\"text\":\"Grenade: Fragmentation Grenade - 250$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_frag_grenade\"}}"
],title:"Buy Menu",author:"System"} 1
I’ve tested shorter versions of the command, and they work fine. However, once multiple elements with clickevent are included, the book is not given. Is this a known issue, or is there a workaround? Could a datapack help solve this problem? Version 1.16.5
/give @s minecraft:written_book{pages:[
"{\"text\":\"Pistol: TTI G34 - 500$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_tti_g34\"}}",
"{\"text\":\"Pistol: TEC-9 - 800$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_tec9\"}}",
"{\"text\":\"Pistol: Colt Python - 900$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_colt_python\"}}",
"{\"text\":\"Pistol: Sawed-Off - 700$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_sawed_off\"}}",
"{\"text\":\"Submachine Gun: UZI - 1200$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_uzi\"}}",
"{\"text\":\"Submachine Gun: MP5A5 - 1500$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_mp5a5\"}}",
"{\"text\":\"Submachine Gun: PP19 - 1500$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_pp19\"}}",
"{\"text\":\"Submachine Gun: UDP9 - 2100$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_udp9\"}}",
"{\"text\":\"Rifle: AK-47 - 2700$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_ak47\"}}",
"{\"text\":\"Rifle: M4A1 - 2700$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_m4a1\"}}",
"{\"text\":\"Rifle: MK-47 MUTANT - 2800$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_mk47_mutant\"}}",
"{\"text\":\"Rifle: MARLIN 1895 - 2100$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_marlin_1895\"}}",
"{\"text\":\"Rifle: SKS - 3200$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_sks\"}}",
"{\"text\":\"Rifle: M24 - 4200$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_m24\"}}",
"{\"text\":\"Grenade: Flashbang(Default) - 300$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_flash_grenade\"}}",
"{\"text\":\"Grenade: Flashbang(Impact) - 600$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_flashbang_grenade\"}}",
"{\"text\":\"Grenade: Smoke - 350$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_smoke_grenade\"}}",
"{\"text\":\"Grenade: Fragmentation Grenade - 250$, \",\"color\":\"black\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/function shop/buy_frag_grenade\"}}"
],title:"Buy Menu",author:"System"} 1
I’ve tested shorter versions of the command, and they work fine. However, once multiple elements with clickevent are included, the book is not given. Is this a known issue, or is there a workaround? Could a datapack help solve this problem? Version 1.16.5
