* @param reason The reason for disconnection.
* @param overrideKick Whether to skip the kick event.
*/
public void disconnect(String reason, boolean overrideKick) {
if (player != null && !overrideKick) {
PlayerKickEvent event = EventFactory.onPlayerKick(player, reason);
if (event.isCancelled()) {
return;
}
reason = event.getReason();
if (event.getLeaveMessage() != null) {
server.broadcastMessage(event.getLeaveMessage());
}
}
// log that the player was kicked
if (player != null) {