Graphitic carbon nitride (g-C3N4) has attracted considerable attention with regard to its use in photocatalytic solar hydrogen production by the splitting of water. High charge carrier recombination critically limits the photocatalytic activity of g-C3N4. Plasmonic metal nanoparticles that can generate localized surface plasmon resonance (LSPR) have been suggested to enhance the harvesting of visible light and to improve water splitting efficiency. However, direct contact between metal nanoparticles and g-C3N4 reduces the hydrogen generation efficiency owing to energy loss by Förster resonance energy transfer (FRET), which competes with plasmon resonance energy transfer (PRET). Decorating g-C3N4 with Ag@SiO2 core-shell plasmonic nanoparticles increases its photocatalytic ability. Tuning the size of the SiO2 nanogap can optimize the photocatalytic performance of g-C3N4/Ag@SiO2, which involves a trade-off between PRET and FRET. X-ray absorption spectroscopy (XAS) is utilized to investigate the electronic structure of g-C3N4 and its modulation with Ag@SiO2. In situ XAS reveals the dynamics of the charge carriers under solar illumination. Analytic results suggest charge redistribution, shifting of the conduction band, modification of the unoccupied states, and consequent improvement in photocatalytic activity by solar illumination. This work sheds light on the effect of LSPR on this photocatalyst with reference to its electronic structure.