ItemJoin

ItemJoin

157k Downloads

[Suggestion] Change page click event for written books

resindrake opened this issue ยท 5 comments

commented

I'm not sure if this is already implemented or not, but the ability to change pages with a click event would be super useful

Quick example using /give command:
/give @p written_book{pages:['{"text":"Go to the next page >>>","underlined":true,"color":"blue","clickEvent":{"action":"change_page","value":2}}','{"text":"Yay!"}'],title:"Page Click Event",author:"ResinDrake"}

commented

Thanks for the example, change_page is not implemented but should be super easy to add considering the new rewrite I did to JSON books.

Currently, the only available events are;
TEXT, SHOW_TEXT, RUN_COMMAND, and OPEN_URL

I will post back when I have added this feature later tonight or tomorrow morning.

commented

Sorry for the late reply, I was working on another feature when you requested this one and it took a bit to finish it.

I have implemented this feature here is an example (recreating what you provided above);

  book-item:
    id: WRITTEN_BOOK
    author: 'ResinDrake'
    slot: 6
    name: '&rPage Click Event'
    pages:
      '1':
      - '<text:&b&nGo to the next page><change_page:2>'
      '2':
      - '<text:Yay!>'
    itemflags: death-drops, self-drops
    triggers: join, respawn
    enabled-worlds: world

Snapshot; http://ci.craftationgaming.com/job/ItemJoin/400/

See; https://github.com/RockinChaos/ItemJoin/wiki/Recent-Changes
for proper JSON formatting, it has been re-coded in the latest release version and I haven't had the chance yet to update the wiki page.


As for the suggest_command it definitely doesn't work for books confirmed by trial & error as well as many spigot forum posts. It looks to be limited to JSON Chat events.

Snippet (Seems the method is deprecated);

     * @deprecated suggest_command does not work in books, this was marked as "Working As Intended" by mojang: See <a href="https://bugs.mojang.com/browse/MC-70317">MC-70317</a>

So I guess in technicality it is supposed to work for books but Mojang has yet to fix it and it has never worked for books since its implementation.

commented

Awesome, thanks so much for this!

commented

Don't want to open another issue for this, but could suggest_command be implemented too?

commented

I couldn't make suggest_command work for books by editing the NBT, so it might be a chat only thing? If so, don't worry about the above comment.