public void stopPlugins() {
        final Thread curThread = Thread.currentThread();
        for (int i = 0; i < pluginsToRun.size(); i++) {
            final IRCPlugin plugin = pluginsToRun.get(i);
            if (plugin != null && plugin.isActive()) {
                if (pluginThreads.get(i) == curThread) {
                    this.stopPlugin(i);
                }
            }
        }
        if (curThread == null) {
            throw new ThreadDeath();
        }
    }