-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Labels
type: featureRequest for a new Feature.Request for a new Feature.
Description
While looking at player quit related stuff, I saw that the actual "quit reason" is logged to console, but this not exposed via an API.
After a little bit of testing it appears that there are 4 different types of leaving the game, with each having their own log reason:
- Leaving normally: "Disconnected"
- Timing out: "TImed out"
- Being kicked from the server: Kick message
- Crashing: Exception message
Based on this, I suggest the addition of the following enum to PlayerQuitEvent:
public enum QuitType {
/**
* The player left on his own behalf.
*/
DISCONNECTED,
/**
* The player was kicked from the server.
*/
KICKED,
/**
* The player has crashed from the server.
*/
CRASHED,
/**
* The player has timed out.
*/
TIMED_OUT
}
and the addition of two new methods inside PlayerQuitEvent:
public QuitType getQuitType() { /* .. */ }- Self explanatorypublic String getCrashReason() { /* .. */ }- Obtain the exception message when a player has crashed.IllegalStateExceptionUnsupportedOperationException ifgetQuitType() != QuitType.CRASHED.
Technically it is possible to implement this as a plugin by adding a custom Appender to the PlayerConnection logger but that seems very hack-ish. (My horrible plugin side code can be found here in case there's interest).
As I'm unable to get a dev environment up and running (damn Windows..) I cannot implement this myself. :(
melinstagibson, caoli5288, Spottedleaf, tr7zw, ricardoboss and 6 moreSpottedleafSpottedleafSpottedleaf and ravkrSpottedleafSpottedleaf and ravkr
Metadata
Metadata
Assignees
Labels
type: featureRequest for a new Feature.Request for a new Feature.