/**
  * Ein Client möchte sich verbinden, so schaut nach was er möchte und winkt ihn durch oder nicht.
  * Gebt ihn dieser Klasse die von {@link BasicClientConnection} abgeleitet ist wenn ihr ihn
  * akzeptiert oder eine <code>null</code> wenn nicht.
  *
  * @param info Enthällt alle Informationen
  */
 @Override
 protected BasicClientConnection incomingConnection(ConnectionInfo info, ByteBuffer data) {
   try {
     byte[] arr = new byte[data.get()];
     data.get(arr);
     String name = new String(arr, DefaultCharSet.getDefaultCharset());
     if (name.equalsIgnoreCase("idiot")) {
       return null;
     } else if (this.takenNames.contains(name)) {
       return null;
     } else {
       return new MyBasicClientConnection(info, this, name);
     }
   } catch (Exception e) {
     return null;
   }
 }
  protected void updateBroadcastMessage(updatePart part) {
    switch (part) {
      case ALL:
        {
          this.broadcastResponce.position(0);
          this.broadcastResponce.putInt(this.currentConnections);
          this.broadcastResponce.putInt(this.maxPlayer);
          this.broadcastResponce.putInt(this.tcpPort);
          this.broadcastResponce.putLong(this.serverId);
          byte[] arr = this.infoText.getBytes(DefaultCharSet.getDefaultCharset());
          this.broadcastResponce.put((byte) arr.length);
          this.broadcastResponce.put(arr);
        }
        break;

      case CUR_PLAYER:
        {
          this.broadcastResponce.position(CUR_PLAYER_POS);
          this.broadcastResponce.putInt(this.currentConnections);
        }
        break;

      case MAX_PLAYER:
        {
          this.broadcastResponce.position(MAX_PLAYER_POS);
          this.broadcastResponce.putInt(this.maxPlayer);
        }
        break;

      case INFO_TEXT:
        {
          this.broadcastResponce.position(INFO_TEXT_POS);
          byte[] arr = this.infoText.getBytes(DefaultCharSet.getDefaultCharset());
          this.broadcastResponce.put((byte) arr.length);
          this.broadcastResponce.put(arr);
          // net to add custom attachment
          if (this.broadcastResponceAttachment == null) {
            this.broadcastResponce.limit(this.broadcastResponceAttachment.position());
            return;
          }
          this.broadcastResponce.put(this.broadcastResponceAttachment);
          this.broadcastResponce.limit(this.broadcastResponce.position());
        }
        break;

      case TCP_PORT:
        {
          this.broadcastResponce.position(TCP_PORT_POS);
          this.broadcastResponce.putInt(this.tcpPort);
        }
        break;

      case SERVER_ID:
        {
          this.broadcastResponce.position(SERVER_ID_POS);
          this.broadcastResponce.putLong(this.serverId);
        }
        break;

      case CUSTOM_ATTACHMENT:
        {
          // get position to write on
          int pos =
              INFO_TEXT_POS + 1 + this.infoText.getBytes(DefaultCharSet.getDefaultCharset()).length;
          // postion from infotext + size info of followed bytes + byte for text

          if (this.broadcastResponceAttachment == null) {
            this.broadcastResponce.limit(pos);
            return;
          }

          if ((pos - this.broadcastResponce.capacity())
              < this.broadcastResponceAttachment.limit()) {
            throw new IndexOutOfBoundsException(
                "Your attachment is to big to fit in message length of broadcastresponceMessage");
          }

          this.broadcastResponce.position(pos);
          this.broadcastResponce.put(this.broadcastResponceAttachment);
        }
        break;

      default:
        break;
    }
    this.broadcastResponce.position(0);
  }