Custom chat fields question

Discussion in 'Plugin Development' started by amitlin14, Feb 7, 2013.

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

    amitlin14

    So this is the deal, i want to use the chat to create custom fields like kills, deaths and pvp kills

    what i want to do is like have my plugin spam the chat with the players messages, but the fist line they see is the fields kills, deaths and pvp kills

    for example, if the chat has 3 messages:
    <p1> hi
    <p2> hello
    <p3> beastiality

    then i want my plugin to send a message to the player with these messages but the first line will be the fields, so it would turn out like this:

    <p1> hi
    <p2> hello
    <p3> beastiality
    Kills: 5 | Deaths: 8 | PvP Kills: 2

    and every time a player says something, it would take all the messages above the custom field, and will send them again to the player, just have the new message at line 2, while the field remains at line 1

    is that recommended to do, performance wise? because on large server with around 30-40 players it would send ALOT of messages, considering it sends 16 every time a player speaks, kills or dies
     
  2. I really don't understand your question?
    If you want to send a message to all players then use broadcast.
    If you want to send a message to all players every few minutes then create a scheduled task.

    Your example isn't very clear, or you're over-complicating the suggested solution. Start with what you want to achieve, not how to achieve it.
     
  3. Offline

    arrexe

    I highly recommend not doing this every time someone speaks. Perhaps set it up on a timed interval, or require players use a command to see "Kills: 5 | Deaths: 8 | PvP Kills: 2" or whatever you wish to output.

    Edit: Posted after Alex. I suggest doing what he says and tell us exactly what you want your plugin to do, rather than use a made up example.
     
  4. Offline

    amitlin14

    AlexLeporiday
    arrexe

    Basically, i want to add fields that appear in the chat that tell the player his stats.
    I want the stats message to always stay at the bottom of the chat, that means, the first line, so the player always sees his stats in the first line. To accomplish this, i need to send the player all previous 15 messages, and have the stats message come last, every time a person speaks, because then the stats line will go up a line, so to prevent that, i just send the player the previous 15 messages, and have the stats message sent last, i also need to do it every time a player kills or dies because then the stats message would need to update.

    I am asking if it is recommended to do, because in larger servers it would need to send 16 messages every time a person speaks, and on larger servers, people speak alot.
     
  5. Offline

    arrexe

    Ah, I understand now. However, this is definitely not the way you should go about doing this. Try thinking of somewhere else to display the users information, such as the Tab menu (I think TabAPI may be capable of this).

    The simplest way to avoid all this that I can think of, is just to output the information when it is changed, such as when someone dies or gets a kill.
     
  6. Don't use the chat as way of displaying a constant score.
    Either have it triggered by a command or display it every time one of the scores changes.
     
  7. Offline

    RainoBoy97

    Why cant he does as he want? MC-PVP does it like this, then why cant he do it?
     
  8. It was a suggestion, not an order.
    The amount of extra legwork the server has to do to maintain a constant message being the last message in chat is horrendous.
     
  9. Offline

    RainoBoy97

    From my side it looked like an order :p
     
Thread Status:
Not open for further replies.

Share This Page