Problem/Bug Broke a book when opening inventory

Discussion in 'Bukkit Help' started by dSalieri, Jun 9, 2019.

Thread Status:
Not open for further replies.
  1. Offline

    dSalieri

    I have books for players where their score is shown. When using a bukkit server, the following problem arises: when a player receives a book, but opens not a book but an inventory, and then opens a book, he does not see his scores (there is just emptiness). But if, after receiving the book, you open it and not its inventory, then everything will be fine.

    You can try it by himself:
    Code:
    /scoreboard objectives add Scores dummy
    /scoreboard players set @p Scores 100
    /give @p written_book{pages:["[{\"text\":\"Scores: \"},{\"score\":{\"name\":\"*\",\"objective\":\"Scores\"},\"color\":\"red\",\"value\":\"@p\"}]"],title:"",author:""} 1
    after these commands:
    1. Open the inventory
    2. Close inventory
    3. Open book by rightclick.

    With spigot or bukkit server(wrong):
    [​IMG]
    With vanilla server(correct):
    [​IMG]


    How to solve this problem?
     
  2. Offline

    Kars

    By the looks of it and judging by the fact that only the colored part disappears, that may be what is at fault. Try removing the color and check again. If that is indeed the problem we will have narrowed it down.
     
  3. Offline

    dSalieri

    @Kars To understand what is the difference between two books, use the command (command block with a button, and above it is a chest with a book)

    Code:
    /data get block ~ ~1 ~
    Correct book (with digits, vanilla):
    Code:
    {x: -1584, y: 72, z: -4435, Items: [{Slot: 0b, id: "minecraft:written_book", Count: 1b, tag: {pages: ["{\"extra\":[{\"color\":\"red\",\"score\":{\"name\":\"dSalieri\",\"objective\":\"Scores\",\"value\":\"840\"}}],\"text\":\"Scores: \"}"], author: "", title: "", resolved: 1b}}], id: "minecraft:chest", Lock: ""}
    Wrong book (without digits, spigot or bukkit):
    Code:
    {x: -1584, y: 72, z: -4435, Items: [{Slot: 0b, id: "minecraft:written_book", Count: 1b, tag: {generation: 0, pages: ["{\"extra\":[{\"color\":\"red\",\"score\":{\"name\":\"*\",\"objective\":\"Scores\",\"value\":\"\"}}],\"text\":\"Scores: \"}"], author: " ", title: " ", resolved: 1b}}], id: "minecraft:chest", Lock: ""}
    Honestly, this behavior is not clear to me.

    P.S Sorry for delay, I did not even hope that someone would help me
     
    Last edited: Jun 14, 2019
  4. Offline

    Kars

    @dSalieri Okay so it isn't putting the text in. But judging by the command you provided in your original post it shouldnt anyway? I think i'm missing the point here.
     
  5. Offline

    dSalieri

    @Kars No, you do not miss anything. Before the book is opened by anyone, it has a state of unresolved(nbt-tag is resolved:0b). This means that as soon as someone opens it all the json code should be calculated accordingly. You can see the correct calculation in the example of the correct book. After this calculation, the book has the status allowed and is no longer subject to re-calculation(nbt-tag is resolved:1b). However, if we do not open the book, but open the inventory, then something strange is happening to the book, as if no one had opened it. Accordingly, there is no record of anyone.

    I assume that this is the bukkit and spigot server code error, since there is nothing on the vanilla server.
     
Thread Status:
Not open for further replies.

Share This Page