Only attempt to leave/disconnect if actually in the channel/connected.

This commit is contained in:
2011-05-07 22:11:50 +01:00
parent 0455ee10e6
commit 34a1e792c3

View File

@@ -117,14 +117,12 @@ public class BukkitXMPP extends JavaPlugin implements PacketListener {
private void disconnect() {
if (muc instanceof MultiUserChat) {
if (muc instanceof MultiUserChat && muc.isJoined()) {
muc.leave();
muc = null;
}
if (xmppconn instanceof XMPPConnection) {
if (xmppconn instanceof XMPPConnection && xmppconn.isConnected()) {
xmppconn.disconnect();
xmppconn = null;
}
}