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

Set kick message?

Comments in 'Plugin Development' started by Legoboy0215, Jun 5, 2015.

  1. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    How do you change the default kick message? Is overidding the only way? If yes, can someone give me an example?
    Creeperface likes this.
  2. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    $player->kick("message", false); you can use this in events which kicking players
    PEMapModder and Legoboy0215 like this.
  3. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    Did you try PlayerKickEvent's setQuitMessage?
  4. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    do you think message which show to client only or messages like "player left the game"?
  5. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    I did. It did not work...
    Creeperface likes this.
  6. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    which messages do you mean? message which display to player "kicked by admin Reason: ddfff" or Join and Quit messages?
  7. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    It works but the problem is that I use "PlayerKickEvent", so I can not just use kick();
    Creeperface likes this.
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    A trick to avoid that:
    Let $main be the instance of your main class.
    For kicking code:
    PHP:
    $main->_WeAreKicking true;
    $player->kick($messagefalse);
    $main->_WeAreKicking false;
    For handler code:
    PHP:
    public function onKick(PlayerKickEvent $ev){
      if(
    $main->_WeAreKicking) return;
      
    // normal code for handling kicking
    }
    Since most of the things in PocketMine are single-threaded, this method can be used.
    Legoboy0215 likes this.
  9. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    "Normal code for handling kicking"
    What do you mean by that?
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Your event handler's original contents
    Legoboy0215 likes this.

Share This Page

Advertisement