Пример #1
0
  public void bindDefaultPorts(Server server) {
    if (!config.ENABLED.getBoolean()) {
      return;
    }
    int bindPort = config.PORT.getInt();

    for (PortBinding binding : server.getBoundAddresses()) {
      if (binding.getProtocol() instanceof VanillaProtocol) {
        if (binding.getAddress() instanceof InetSocketAddress) {
          InetSocketAddress addr = (InetSocketAddress) binding.getAddress();
          if (addr.getPort() == bindPort) {
            getLogger()
                .warning(
                    "Port binding on "
                        + addr
                        + " is already occupying the port set for rcon, not binding!");
            continue;
          }

          bind(new InetSocketAddress(addr.getAddress(), bindPort));
        }
      }
    }
  }
Пример #2
0
 public void connect(final PortBinding binding) {
   potentialBinding.set(binding);
   getBootstrap()
       .connect(binding.getAddress())
       .addListener(new SpoutClientConnectListener(this, binding));
 }