*/
    protected void sendText(String thisText) {
        if (state == TrekPlayer.WAIT_PLAYING) addToOutputBuffer(thisText);
        else {
            synchronized (this) {
                try {
                    thisText = thisText.replace('\010', '\000');
                    if (state != WAIT_PLAYING) {
                        Timer timeToDie = new Timer("TimeToDie1-" + shipName);

                        // if it's a bot, don't spawn new threads
                        if (this instanceof TrekBot) {
                            if (TrekServer.doBotHuds()) {
                                out.write(thisText.getBytes());
                                out.flush();
                            }

                            if (isObserved) {
                                for (Enumeration e = theObservers.elements(); e.hasMoreElements(); ) {
                                    TrekPlayer curObs = (TrekPlayer) e.nextElement();
                                    if (curObs == null) continue;
                                    if (curObs.state != TrekPlayer.WAIT_PLAYING) {
                                        theObservers.remove(curObs.ship.name);
                                        if (theObservers.size() == 0) isObserved = false;
                                        continue;
                                    }
                                    TrekDeadThreadKiller task = new TrekDeadThreadKiller(curObs);
                                    try {
                                        timeToDie.schedule(task, 1000);

                                        curObs.out.write(outputBuffer.getBytes());
                                        curObs.out.flush();

                                        timeToDie.cancel();
                                    } finally {
                                        task.cancel();
                                        timeToDie.cancel();
                                        timeToDie = null;
                                    }
                                }
                            }
                        } else {
                            if (!isObserving) {
                                TrekDeadThreadKiller task = new TrekDeadThreadKiller(this);
                                try {
                                    timeToDie.schedule(task, 1000);

                                    out.write(thisText.getBytes());
                                    out.flush();

                                    timeToDie.cancel();
                                } finally {
                                    task.cancel();
                                    timeToDie.cancel();
                                }
                            }

                            if (isObserved) {
                                for (Enumeration e = theObservers.elements(); e.hasMoreElements(); ) {
                                    TrekPlayer curObs = (TrekPlayer) e.nextElement();
                                    if (curObs == null) continue;  // how to remove a null object from the hashtable?

                                    if (curObs.state != TrekPlayer.WAIT_PLAYING) {
                                        theObservers.remove(curObs.ship.name);
                                        if (theObservers.size() == 0) isObserved = false;
                                        continue;
                                    }

                                    timeToDie = new Timer("TimeToDie2-" + shipName);
                                    TrekDeadThreadKiller task = new TrekDeadThreadKiller(curObs);
                                    try {
                                        timeToDie.schedule(task, 1000);

                                        curObs.out.write(thisText.getBytes());
                                        curObs.out.flush();

                                        timeToDie.cancel();
                                    } finally {
                                        task.cancel();
                                        timeToDie.cancel();
                                    }
                                }
                            }
                        }
                    } else {
                        if (playerOptions.getOption(TrekPlayerOptions.OPTION_BEEP) != 0) {
                            thisText = thisText.replace('\007', '\000');
                        }
                        addToOutputBuffer(thisText);
                    }
                } catch (java.net.SocketException se) {
                    TrekLog.logError(se.getMessage());
                    state = WAIT_SOCKETERROR;
                } catch (java.io.IOException ioe) {
                    TrekLog.logError(ioe.getMessage());
                    state = WAIT_SOCKETERROR;
                } catch (Exception e) {
                    TrekLog.logException(e);
                    state = WAIT_SOCKETERROR;
                }
            }
        }
    }