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

Check reason for player leave

Comments in 'Plugin Development' started by wolfdale, Mar 31, 2015.

  1. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    Is it possible to check the reason the player left the server? such as timeout or client disconnect?
  2. yungtechboy1
    Offline

    yungtechboy1 Active Member Plugin Developer

    Joined:
    Dec 25, 2014
    Posts:
    57
    Plugins:
    1
    Minecraft User:
    yungt
    Yes, The Server Log prints it out.
  3. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    is it possible for a plugin to check that?
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You may want to look at $event->getQuitMessage()
  5. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    what i am trying to achieve is for a plugin to get if the player quits by client disconnect or by timeout, is that possible?
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Why not try dumping getQuitMessage() in your tests and see the values so that you can just check if the values match the ones in your tests?
  7. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    Im sorry, i dont see any difference?
    [​IMG]
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Then I don't think you can.

    But also think about PlayerKickEvent. I don't think it helps, but you can still try.
  9. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    You could simply read the "server.log" file. It is recorded there.
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    He is asking about with a plugin...

    Uhh well, you could do that using the OB family of functions (like ob_start()), but not sure if it is even present in PocketMine extensions.
  11. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    AFIK, you can fopen("server.log","w") ... etc... from a plugin.
    It is not as real time but it is no different from checking the server.log from another program.
  12. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No, that is not good because it will fight for resources with the server.
    Better do addAttachment() on MainLogger.
    mamayadesu likes this.

Share This Page

Advertisement