protected void sendOutputBuffer() {
        synchronized (this) {
            try {
                if (!outputBuffer.equals("")) {
                    outputBuffer = outputBuffer.replace('\010', '\000');

                    if (this instanceof TrekBot) {
                        if (TrekServer.doBotHuds()) {
                            out.write(outputBuffer.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;
                                }
                                Timer timeToDie = new Timer("TimeToDie3-" + shipName);

                                timeToDie.schedule(new TrekDeadThreadKiller(curObs), 1000);

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

                                timeToDie.cancel();
                            }
                        }
                    } else {
                        if (!isObserving) {
                            Timer timeToDie = new Timer("TimeToDie4-" + shipName);
                            timeToDie.schedule(new TrekDeadThreadKiller(this), 1000);  // you have 1 second to comply

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

                            // if you made it here in less than 1 second, you're still alive, otherwise... goodbye, you are the weakest link
                            timeToDie.cancel();
                        }

                        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;
                                }
                                Timer timeToDie = new Timer("TimeToDie5-" + shipName);

                                timeToDie.schedule(new TrekDeadThreadKiller(curObs), 1000);

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

                                timeToDie.cancel();
                            }
                        }
                    }
                }
            } catch (Exception e) {
                TrekLog.logException(e);
                state = WAIT_SOCKETERROR;
            } finally {
                outputBuffer = "";
            }
        }
    }