public override object onReceive() { BinaryReader packetData = (BinaryReader)this.stream; bool success = packetData.ReadBoolean(); uint clientID = packetData.ReadVarUInt32(); string rejectReason = packetData.ReadStarString(); Client target = StarryboundServer.getClient(clientID); if (target != null) { target.forceDisconnect(direction, "The parent server reclaimed this clientId"); StarryboundServer.logError("[" + this.client.playerData.name + "] " + direction + ": The parent server reclaimed this clientId (" + clientID + ")"); return(true); } this.client.playerData.id = clientID; PlayerData player = this.client.playerData; if (!success) { this.client.rejectPreConnected("Connection Failed: Rejected by parent server: " + rejectReason); return(true); } StarryboundServer.addClient(this.client); string geoip_prefix = ""; if (StarryboundServer.config.enableGeoIP && StarryboundServer.Geo != null) { var code = StarryboundServer.Geo.TryGetCountryCode(IPAddress.Parse(player.ip)); var geo_loc = code == null ? "N/A" : GeoIPCountry.GetCountryNameByCode(code); geoip_prefix = String.Format("({0})", geo_loc); } StarryboundServer.sendGlobalMessage(String.Format("{0}{1} has joined the server!", player.name, geoip_prefix)); this.client.state = ClientState.Connected; StarryboundServer.logInfo(String.Format("[{0}][{1}] joined with UUID [{2}]{3}", this.client.playerData.client, this.client.playerData.ip, player.uuid, geoip_prefix != "" ? String.Format(" from {0}", geoip_prefix) : "")); return(true); }