Checks if in chat

Discussion in 'Plugin Development' started by dubknights, Apr 14, 2014.

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

    dubknights

    how would i check if what someone said ended up in the chat? for example if a hacker types ".killaura" it wont be sent to chat because its a hacked client command, how would i check that?
     
  2. Offline

    ShearsSheep

    Code:java
    1. public void onEnable() {
    2. Bukkit.getServer().getPluginManager().registerEvents(this, this);
    3.  
    4. }
    5.  
    6. @EventHandler
    7. public void onPlayerChat(AsyncPlayerChatEvent e) {
    8. //Check's wether the player said ".KillAura"
    9. if (e.getMessage().contains(".KillAura"));
    10.  
    11. //Sends the Player by e.getPlayer() the message "That message is not Allowed" When the player says ".KillAura"
    12. e.getPlayer().sendMessage(ChatColor.RED + "That Message is not allowed");
    13. //Cancel's the event, thus not sending ".KillAura in the chat"
    14. e.setCancelled(true);

    I think this is correct, Correct me if i'm wrong.
     
    DrEinsteinium likes this.
  3. Offline

    dubknights


    No, i want a way to check if it got sent to the chat. because if someone where to type .killaura with a hacked client, it wouldnt get sent to the chat because it would act as a command for the client. how do i check if that has happened? like check if it wasnt sent?
     
  4. Offline

    dubknights

Thread Status:
Not open for further replies.

Share This Page