Force a player to use held item

Discussion in 'Plugin Development' started by atesin, Mar 9, 2016.

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


    hi .... i am trying to force a player to use his held item ... previously i gave him a formatted book, i want the player opens as an interface to my plugin

    in this old post i readed this 2 lines could help ... but i am lost, i don't know the implementation, the requirements, etc

    PacketPlayOutCustomPayload packet = new PacketPlayOutCustomPayload("MC|BOpen", new PacketDataSerializer(Unpooled.EMPTY_BUFFER));
    if somebody could make it work and post the steps would be terrific... thanks
  2. Offline


    Should the player can do nothing until he opened the book once? If so, a way of doing this could be:

    After playerjoin, add his name (or UUID) to a List, which stores players who didnt open the book. Then, make events for things players not allowed to do until they opened it. I. e. check in an PlayerItemHeldEvent if the player is on the list, if so cancel the event. So he cant switch to another item.

    If theyre not allowed to move around, do the same in an PlayerMoveEvent.

    Until they interacted with the book, remove them from the list.
  3. Offline



    instead obligating the player to do it himself ... i want to send an order (control?, packet?) to the game client to "use" its currently held item (ie. a book), remotely from the server ...

    so when the player make another related action (ie. type a "/mail" command, interact with the "mailbox" block, etc) ... the server prepare the "inbox" book, send it to the player, suddenly "opens" in the player gui, and restores his previous item in hand

    ..... the player will never realize the server changed his held item, "opens" it, and restore previous, because all this occur so fast
  4. Offline


    Link 1
    Link 2
    Doesnt look very well.. maybe you better stick with custom inventorys.
  5. Offline


    yes, but too bad custom inventories just shows icons not text, and book gui just have 14 chars wide...

    i that case, maybe i better stick with mc chat interface... just i would like a way of:

    - queue incoming messages while i am viewing inbox, to avoid text scroll
    - stay chat area opened (as if i had pressed [enter]), to get advantage of 20 text lines and click text links more easy
    Last edited: Mar 11, 2016
  6. Offline

    I Al Istannen

    Did you write the plugin with the custom clickable book item? If so, you will have a method that opens the book if you right click. Why don't you just call this method directly, without going over giving the book and right clicking it?
  7. Offline


    that is what i would like to do ... opening the game client book interface directly from the server

    do you know how to do it?
  8. Offline

    I Al Istannen

Thread Status:
Not open for further replies.

Share This Page