Solved Locking /me

Discussion in 'Plugin Help/Development/Requests' started by 2008Choco, Apr 2, 2015.

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

    2008Choco

    (I'm asking a lot of questions today :p)
    I have a command that locks chat completely for all players that aren't staff, however they can get around the lock with /me <action>. I knew this was going to be an issue, I just never knew how to fix it.
    Is there a way I can restrict the use of /me while the chat is locked? Here was my attempt at doing it. It was trial and error, really.

    Code:
    if (event.getMessage().startsWith("/me")){
        event.setCancelled(true)
        event.getPlayer().sendMessage("You cannot use /me while chat is locked")
    }
    (This is in a PlayerChatEvent by the way)
     
  2. Offline

    Konato_K

    @2008Choco In any case you'll have to use PlayerPreProcessCommandEvent, and split the "message" instead if just using startsWith, since that will block commands like "/menacing" or any other things that start with me.

    Anyway, stop trying to make something like that and remove the respective permissions instead.
     
  3. Offline

    2008Choco

    @Konato_K Thank you :) I appreciate the help. And if I wanted to remove the /me permission, I woulda just done that in the first place :p But I let players use it. Thanks again :D
     
  4. Offline

    mrCookieSlime Retired Staff

    Locked on request.
     
Thread Status:
Not open for further replies.

Share This Page