/**
   * Sends the server mod list to the client, or stores it for sending later.
   *
   * @param modList The {@link PluginMessage} to send to the client containing the mod list.
   * @throws IllegalArgumentException Thrown if the {@link PluginMessage} was not as expected.
   */
  public void setServerModList(PluginMessage modList) throws IllegalArgumentException {
    if (!modList.getTag().equalsIgnoreCase(ForgeConstants.FML_HANDSHAKE_TAG)
        || modList.getData()[0] != 2) {
      throw new IllegalArgumentException("modList");
    }

    this.serverModList = modList;
  }
  @Override
  public void handle(PluginMessage pluginMessage) throws Exception {
    if (pluginMessage.getTag().equals("BungeeCord")) {
      throw new CancelSendSignal();
    }
    // Hack around Forge race conditions
    if (pluginMessage.getTag().equals("FML") && pluginMessage.getStream().readUnsignedByte() == 1) {
      throw new CancelSendSignal();
    }

    PluginMessageEvent event =
        new PluginMessageEvent(
            con, con.getServer(), pluginMessage.getTag(), pluginMessage.getData().clone());
    if (bungee.getPluginManager().callEvent(event).isCancelled()) {
      throw new CancelSendSignal();
    }

    // TODO: Unregister as well?
    if (pluginMessage.getTag().equals("REGISTER")) {
      con.getPendingConnection().getRegisterMessages().add(pluginMessage);
    }
  }