Solved Hide message from certain player

Discussion in 'Plugin Development' started by Alex_Cboy, Nov 29, 2016.

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

    Alex_Cboy

    Hey bukkit guys(members & admins/mods)!I have a problem.. i want to hide a message from a certain player given in-chat, is that even possible?And if yes how?

    When the player is mentioned in a message by someone else he want be able to see the message
    Thanks for your time!

    [EDIT] Solved with @Zombie_Striker 's post!
    Thank you man!
    Code:
    //All the code
    //inside the ASyncChatEvent after all do this and the player won't be able to see the message!
    e.getRecipients().remove(Bukkit.getPlayer(player));
    
     
    Last edited: Nov 30, 2016
  2. Offline

    MrGeneralQ

    Let's use this example:

    You want to send a message to all online that have the permission "chat.read"


    1. create a for loop through all players on the server (bukkit.getOnlinePlayers()
    2. check if the player has the permission (if the player has the permisson then send message to the player object in the for loop , if he doesn't have permission then continue;
    3. done!
     
  3. Offline

    jlin13

    You could send a message to every player except for that one player when listening on the AsyncPlayerChatEvent
     
  4. Offline

    BeastyBoo

    @Alex_Cboy
    Hello, like what do you mean?
    you could make a command like example:
    /msghide <target_player> <the message>
    where you make the "target_player" not see "the_message"
     
  5. Offline

    Alex_Cboy

    @MrGeneralQ
    I've done that but that doesnt help me,is there any way to hide a message that contains his name in it?
    If a message is sent, and the message contains his name in the player won't be able to see it, im sorry for not explaining it good .. changing it right now! :D

    @BeastyBoo i edited the thread and somehow like that but not exactly like that. I want it to be hidden when he is mentioned in the chat .
    @BeastyBoo I'll look at it but as far as i've tried to do this exact thing i haven't got any good response from the plugin :p
    @Zombie_Striker I'll try this and reply to you as soon as possible!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited: Nov 29, 2016
  6. Offline

    BeastyBoo

    @Alex_Cboy
    erm, this might not be 100% accurate, however maybe have a chat event which has a loop where if the message contains the name of a player in game, get the targeted player and cancel the message for him? or hide it. idk if u are able to cancel a message for only 1 person.
     
  7. Offline

    Zombie_Striker

    @Alex_Cboy
    AsyncChatEvent#getRecipients().remove( The player)
     
    MrGeneralQ likes this.
Thread Status:
Not open for further replies.

Share This Page