Skip to content

Commit b160d0d

Browse files
committed
BUGFIX:
- Scheduler: mission_id / mission_file was not processed correctly on populated servers
1 parent cf71b6d commit b160d0d

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

plugins/mission/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ async def _load(self, interaction: discord.Interaction, server: Server, mission:
379379
if mission_id and result == 'later':
380380
# make sure, we load that mission, independently on what happens to the server
381381
await server.setStartIndex(mission_id + 1)
382-
server.on_empty = {"command": "load", "id": mission_id + 1, "user": interaction.user}
382+
server.on_empty = {"command": "load", "mission_id": mission_id + 1, "user": interaction.user}
383383
await interaction.followup.send(
384384
_('Mission {} will be loaded when server is empty or on the next restart.').format(name),
385385
ephemeral=ephemeral)

plugins/scheduler/commands.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,11 @@ async def restart_mission(self, server: Server, config: dict, rconf: dict, max_w
243243
if not rconf.get('populated', True) and not rconf.get('max_mission_time'):
244244
if not server.on_empty:
245245
server.on_empty = {'command': method}
246+
if method == 'load':
247+
if 'mission_id' in rconf:
248+
server.on_empty['mission_id'] = rconf['mission_id']
249+
elif 'mission_file' in rconf:
250+
server.on_empty['mission_file'] = rconf['mission_file']
246251
self.log.debug("Scheduler: Setting on_empty trigger.")
247252
server.restart_pending = True
248253
return

plugins/scheduler/listener.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ async def process(self, server: Server, what: dict) -> None:
118118
asyncio.create_task(self.bot.audit(f"{self.plugin_name.title()} rotated to mission "
119119
f"{server.current_mission.display_name}", server=server))
120120
elif what['command'] == 'load':
121-
if not await server.loadMission(what['id']):
121+
if not await server.loadMission(what.get('mission_id', what.get('mission_file'))):
122122
self.log.warning(f"Mission {server.current_mission.display_name} NOT loaded.")
123123
else:
124124
message = f'loaded mission {server.current_mission.display_name}'

0 commit comments

Comments
 (0)