public boolean disconnect() {
        if (this.isConnected()) {
            if (Variables.partOnDC) {
                for (final IRCChannel c : Variables.channels) {
                    this.part(c);
                }
            }
            try {
                this.write("QUIT Leaving.");
                input.close();
                outputQueue.clear();
                output.close();
                this.getReader().close();
                connection.close();
                IRC.log("Successfully disconnected from IRC.");
            } catch (final Exception e) {
                outputQueue.clear();
                IRC.log("Successfully disconnected from IRC.");
            }
        }
        final IRCDisconnectEvent devent = new IRCDisconnectEvent(server);
        plugin.getServer().getPluginManager().callEvent(devent);
        final PluginDisconnectEvent pde = new PluginDisconnectEvent(server);
        MonsterIRC.getEventManager().dispatchEvent(pde);
        return !this.isConnected();
    }