The historical setting of the short story "The Sniper" by Liam O'Flaherty is the Irish Civil War, which took place from late June 1922 to late May 1923. The Irish War of Independence had just ended, and the United Kingdom had proposed the Anglo-Irish Treaty, which would create a self-governing Irish state. However, many members of the Irish Republican Army (IRA) objected to the terms of the treaty, so the Irish began fighting among themselves between those who opposed the treaty and those who supported it.
More specifically, "The Sniper" takes place during the Battle of Dublin, which occurred during a week at the beginning of the Irish Civil War from June 28 to July 5, 1922. To confirm this, the story mentions "the long June twilight." This was a period marked by intense street fighting in Ireland's capital city.
As for the physical setting of the story, O'Flaherty mentions that the sniper can see the "dark waters of the Liffey." The Liffey is a river that runs through the midst of the city of Dublin. O'Connell Bridge, which spans the River Liffey, is also mentioned. The sniper can hear guns firing at the battle of Four Courts. The Four Courts is the site of the Supreme Court of Ireland and other courts in the center of Dublin. This building had been occupied by anti-treaty IRA members. Following a tense standoff, the Irish National Army began to bombard the Four Courts, using British artillery.
We see, then, by the background O'Flaherty provides in his story that the sniper must have been right near the middle of the action during the Battle of Dublin. Specifically, he is on a rooftop near the bridge on a moonlit night. His job seems to be to watch the road and kill any members of the opposing forces that he spots.