How to get message of crash?

Discussion in 'Plugin Development' started by matcracker, Oct 2, 2015.

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

    matcracker

    The title says all. I want to get message of disconnection when player leave the game or crash, is it possible? If yes, tell me how. Thanks to all!

    Example:
    Code:
    //....
    String errormessage = "java.error" //etc...
    If(player.getErrorMessage() == errormessage){
    //Yes I know, "getErrorMessage" doesn't exist, but I need a function as this.
    //Do something...
    
    }
    
    
     
  2. as in leave the server?
     
  3. Offline

    stefvanschie

    Use the playerquitevent
     
  4. Offline

    matcracker

    Yes, it's in PlayerQuitEvent (so, player = event.getPlayer()), but I doesn't want the message "Player join/left the game" but the message of cause when player crash from the server.
     
  5. Online

    timtower Administrator Administrator Moderator

    @matcracker Don't think that you can find the reason.
     
  6. Offline

    SuperSniper

    @matcracker It's not possible to find the reason of the crash
     
  7. Offline

    567legodude

    @matcracker When a player leaves the server in any way, the console will log the reason that they got disconnected.
     
  8. Offline

    Boomer

    All crashes from the servers are a disconnect, but not all disconnects are a crash.
    All little girls are humans, not all humans are little girls.
     
  9. Offline

    567legodude

    @Boomer I didn't say all disconnects were a crash, I'm saying that when someone leaves the server, it logs it. So when someone crashes, you can get the reason there.
     
  10. Offline

    matcracker

    Yes I know but, any way to get this?
     
  11. Offline

    Boomer

    Yes it logs their leaving, but, it doesn't sense "a crash"
    The best it can do is distinguish a perfectly clean logout disconnect from a Red-X client shutdown, which looks like a network cable being pulled out, which looks like a power failure, which looks like a DOS attack on their house, which looks like a java 6_14 version bug they're using for the launcher suddenly blowing up, which looks like .... any other cause for an unclean connection termination. Its not like the client crashes and then sends a specific packet that signals that their java crashed, or a packet that signals their client crashed due to graphics rendering of a corrupt chunk, or their power cuts out and the client can send a "out of power" packet for the server to interpret.

    The server basically says "uh...hello? Helllooooooo? Hm, no signal" and agrees that the disconnection has resulted in no packets indicating what it was doing. Whereas a clean logout will send a logout button signal to the server, so the server knows its a clean logout - every OTHER case, of which craahes are included, is simply a lack of "im still here" traffic, and a lack of "I'm logging out now" traffic having been sent.

    If the server gets nothing from scenario A, and nothing from scenario B and nothing from scenario C... and nothing from Scenario D... or scenario E.... and nothing from scenario F .... then when your friend signal is lost without having logged out, and the server is looking at a big fat nothing piece of information -- is that nothingness the scenario F nothing, or the scenario D nothing? It is not possible to infer which scenario caused a result, when the result is identical for multiple scenarios.
     
  12. Offline

    matcracker

    How can I have the packets that send players to server?
     
  13. Offline

    Boomer

    The point I was making is that when a client disconnects from the server, there ARE no packets sent that say why it disconnected - you can't logically and physically send a packet that represents "All power was lost and the computer shut down" or "The cable got cut in half" or "The client crashed from a java error" because as soon as those events happen, thats it, the client is FINISHED and goes silent... and the server is left with unacknowledged handshakes and quietness on a listening connection that it is then forced after an appropriate amount of time to assume that the connection has been lost without being told that it is about to be lost. So to the server, the client closing the game with the X corner window, the client crashing, the dog chewing through the internet cable, a lightning bolt frying the electrical systems in a house, the residential ISP killing services to perform maintenence on the systems, a transport-truck overturning and smashing into a central communication distribution box a mile away from the player's house, the player being upset about creeper that blew him up and hulk-smashed his computer so hard it generated the blue screen of death because he caused the harddrive to jump its tracking system, the player's mother being so angry at him not having taken the garbage out the 13 times earlier she told him to that she just reached over and hit the power-off button on his computer, or the player walking his laptop from the kitchen to the living room and losing his wireless router signal strength dropping his connection --- all of those scenarios look the same to the server.

    So you have either ^^^^ All those ^^^^ OR a clean player leave event when he clicks the "Disconnect" button on the menu to leave the game. That should be catchable as a data packet
    [​IMG]
     
    matcracker likes this.
  14. As far as I know there is no way a for a plugin to detect when a player crashes. If you use a custom Bukkit build you could do that but obviously you would still need a custom build.
     
Thread Status:
Not open for further replies.

Share This Page