Messages in 1.8

Discussion in 'Plugin Development' started by 0LUMIN4T0R, Dec 7, 2015.

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

    0LUMIN4T0R

    Hey guys,
    i have a question. I want to send big messages in the middle of the screen. Like on Mineplex after you joined the game, but i don't now how to do it.
    I hope you can help me:oops:
    Thx
    Ole
     
  2. Offline

    mcdorli

    You need to send a PacketPlayOutTitle trough the playerconnection.
     
  3. Offline

    TheNewTao

    You could also use the sendTitle() method
     
  4. Offline

    mcdorli

    Is there one? I never found it before. I couldn't even find it now.
     
  5. Offline

    TheNewTao

    @mcdorli
    Yeah there is one, it takes two arguments. The title and the subtitle strings.
     
  6. Offline

    mcdorli

    Can you please show it, where you found it? I don't think people would request it for the spigot 1.9 update, if it is already in the API.
     
  7. Offline

    TheNewTao

  8. Offline

    0LUMIN4T0R

    Thx, yes:
    player.sendTitle("", "");

    And the message directly over the hotbar?
    ;)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Dec 7, 2015
  9. Offline

    mcdorli

    That's a actionbar. You need to send the second chat type with packets

    PacketPlayOutChat(cbc, 2);

    cbc is a IChatbBaseComponent, 2 is the id of the actionbar.
    Don't forget, you need to send the message in a json file
     
  10. Offline

    0LUMIN4T0R

    I'd never worked with packets. Could you explain something?
     
  11. Offline

    Zombie_Striker

    @0LUMIN4T0R
    What you are going to do requires a little understanding of packets.

    Let me just post how you would go about this:

    1. Create a "IChatBaseComponent" Heres a link on how to do that.
    https://bukkit.org/threads/ichatbasecomponent-help.318790/
    2.Edit that component to have the text you want to send.
    3. Create this variable. (replacing cbc with your IChatBase)
    4.Send the packet to the player. (Use player.getPlayer().getCraftPlayer().sendPacket(Your packet); )
     
Thread Status:
Not open for further replies.

Share This Page