Solved Help needed sending message to specific players!

Discussion in 'Plugin Development' started by CrazyYoungBro, Jun 12, 2016.

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

    CrazyYoungBro

    Hello,
    I am making a plugin which sends message to all online staff members on running a command, and all the online staff members can respond to them by running another command. My problem is I don't know how to get the list of staff members online and make the message so that it only is sent to the staff online. Also, how to do that any staff online can reply to that message such that only the player who sent the message recieves it.
     
  2. Offline

    timtower Administrator Administrator Moderator

    @CrazyYoungBro give the staff certain permission nodes.
    lopp through the online players.
    Check if they have that permission
    If so: send message
     
  3. Offline

    mine-care

    You should do what @timtower recommended for the first part of your question, (loop)
    As for the second part, you need to log which players received the message and if any of them type /reply <whatever> you should trace the player assigned (the one who sent the message initially) that can be done through a Map of various other methods. For more ideas on this check out how /msg command works in other plugins and furthermore how the reply command works.
     
    Last edited: Jun 12, 2016
  4. Offline

    CrazyYoungBro

    Thanks a lot @timtower and @mine-care.

    @mine-care, Could you explain on how I could log which player sent the message?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
  5. Offline

    mine-care

    @CrazyYoungBro I don't really know much about your code and your implementation so i can't directly recomend a way but i can say that you need to find a suitable datastructure depending on the way you are implementing this, such as a Collection, an array or a Map
     
  6. Offline

    CrazyYoungBro

    @mine-care
    There is nothing implemented till now. I'm just figuring out how to make it work currently. I basically want a command which will allow normal users to chat with online staff. If there is any staff online, they cab respond to the message by running another command. I know how to make it work but not how to get the reply to be sent to the player who ran the command.
     
  7. Offline

    timtower Administrator Administrator Moderator

  8. Offline

    CrazyYoungBro

    @timtower Whose playername?
    I don't want to add staff playername, I want it to cycle through all staff members and find the online staff and send the message to them
     
  9. Offline

    timtower Administrator Administrator Moderator

  10. Offline

    CrazyYoungBro

    There will be the staff member name in the reply part.
     
  11. Offline

    timtower Administrator Administrator Moderator

    @CrazyYoungBro The staff needs to reply to somebody.
    What if there are multiple?
    Let them use /reply <requester> <msg> instead of just /reply
     
  12. Offline

    CrazyYoungBro

    Yes will do but how?

    I also need help on how to get list of all players online.

    I want something like
    if(x.hasPermission("permission")) {
    x.sendMessage();
    }
    In this x is all the players online

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
Thread Status:
Not open for further replies.

Share This Page