Opening a written book GUI

Discussion in 'Plugin Development' started by xigsag, Jun 14, 2014.

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

    xigsag

    Getting straight to the point, is there a way to open up the written book GUI without having right click a written book? e.g right clicking an enchanted book instead through PlayerInteractEvent.
     
  2. Offline

    jthort

  3. Offline

    xTigerRebornx

    xigsag AFAIK, opening books is client-sided.
     
  4. Offline

    jthort

    xTigerRebornx It is, but you can just get the contents of a book and save it, then when you need it just open up a gui and show the contents
     
  5. Offline

    xTigerRebornx

    jthort That may not always work. What happens when you have a book that has, say, 8 full pages. It may be a solution, but throwing a book with mass amounts of info may not work (it may become illegible for the client if stored in Lore).
    You CAN do that, but that isn't "opening the written book gui", which is what the OP wants.
     
    jthort likes this.
  6. Offline

    xigsag

    xTigerRebornx jthort Thanks for the replies. I don't see how this hasn't been implemented as an official API yet though, since all of the book meta are stored within server files, and all the server would have to do is open up the gui and copy paste the contents, as mentioned by jthort.

    I'd assume it'd be pretty much the same as opening an inventory gui and adding items into the inventory. Though I guess that would be a bit different, since most plugins would just create a new inventory with new items every time the method was called, instead of having the inventory and items stored as static data.

    Oh well, it's a shame. Guess I'll have to stick to editing books with the boring old written books item.
     
  7. Offline

    Chlorek

    The guy above me is totally incorrent. This task is impossible because of the way books are working. It's just an item with data attached that is sent to client. When player right-clicks his client simply opens GUI (it's not handled via any packets) and fills it with data attached to that book item.
     
  8. Offline

    xize

    I'm not 100% sure if its handled in client side because I'm 100% sure an book gui can be closed as an inventory so how is that possible in p.closeInventory(); because it closes that indicates me it may has a holder but maybe not direct provided through bukkit question what does InventoryCloseEvent tells when closing a book? Things like the inventory holder are perhaps interesting.

    -edit-
    woops I just see ive wrote a book open event but had never used it for my plugin just as an api thing:p

    what I see is just check if the meta is a instance of BookMeta so you are 100% sure its an book than pass it through a custom event, and I remember when a book needs to be writed and is not signed then things will go to client sided.

    see:
    https://github.com/xEssentials/xEss...nts/customEvents/CallPlayerOpenBookEvent.java

    and the event:
    https://github.com/xEssentials/xEss.../events/customEvents/PlayerOpenBookEvent.java
     
Thread Status:
Not open for further replies.

Share This Page