Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Canceling Events

Comments in 'Plugin Development' started by jython234, May 11, 2014.

  1. jython234
    Offline

    jython234 Notable Member Plugin Developer

    Joined:
    Nov 4, 2013
    Posts:
    324
    Plugins:
    1
    Minecraft User:
    jython234
    Let's say I want to create a plugin that mutes a player... (Don't tell me that they already exist I KNOW!)
    I want to listen in on the player.chat event, then when the player attempts to say something, it cancels the event so the player can't say anything...

    Is this possible? If so, how?
  2. jython234
    Offline

    jython234 Notable Member Plugin Developer

    Joined:
    Nov 4, 2013
    Posts:
    324
    Plugins:
    1
    Minecraft User:
    jython234
    Thank you, would it just be like this?
    PHP:
     public function onPlayerChat($player){
           
    //Player chat event
           
    case player.chat
               
    return false;
               break;
         }
  3. jython234
    Offline

    jython234 Notable Member Plugin Developer

    Joined:
    Nov 4, 2013
    Posts:
    324
    Plugins:
    1
    Minecraft User:
    jython234
    Ok thanks!
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    After returning false, the function is escaped and no need, nor would it be read, the break.
  5. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    I think just do return false

Share This Page

Advertisement