Event for messages sent to a player, or at least a way to cancel them

Discussion in 'Plugin Development' started by Muizers, May 22, 2012.

Thread Status:
Not open for further replies.
  1. Well that's what I'm looking for :)

    So, I'm looking for some event that is called whenever a message is sent TO a player. I'm intending to check the messages that are sent TO a player FROM a plugin (for example when they utilize the sendMessage method) and cancel them if needed.

    For example, I have an auto-save every 1 minute, and I don't want the 'Forcing save...' bladibla to be sent to every op. NO, I do not want to use Reflection or some other work-around way.

    I just want to be able to do some stuff when a message is sent to a player, like check what the message is, and be able to cancel it.

    This must be possible, I mean Bukkit knows when the packets are sent right haha xd

    As I mentioned above, I'm right now only interested in the message sent by plugins, so I don't need to see messages sent to players that originate from chat messages by other players. But I don't mind if they are included. I just want any way to see if a message is sent to a player, at least including messages sent to player from plugins.

    I guess more people should be having this issue, but who knows, there might be a solution. Thanks for answering!! :D
     
  2. Offline

    SirTyler

    There is no event when a plugin sends a message, only if a player chats. Only way would be to listen for outgoing packages I assume, which seems like a hassle to get the right ones.
     
  3. Then it's time this event gets created!
     
  4. why you not deny the broadcast perm,ission, so they dont recieve the message anny more, or make your own inplementation of save-all that dont spam?
     
  5. I don't see what you mean. There's not a permission that decides whether or not people get the 'Forcing save...' message.

    Yes it would be possible to create an own implementation of save-all that doesn't spam. I think.

    But that's not what I'm after. I don't want just that case.

    What I REALLY want is to be able to check the message that is sent, like "Martijn has logged in.", do some stuff with the string and then perhaps cancel the sending of it. Like if ANY message (also by plugin) sent to a player contains "shit": don't send it to them. Just an example.
     
  6. there is an permission for the forcing save messages (operator chat), the permission is bukkit.broadcast.admin and operators default get this permission
     
Thread Status:
Not open for further replies.

Share This Page