In https://github.com/Nikey646/Kuuhaku/commit/f386b595b78cc0615963804180903d9163f8a74a, the CommandService was made into a Singleton rather than declared per-class. This change didn't take into account the fact that multiple CommandHandlers could be created, and now the Modules and all their commands are being loaded into the CommandSerivce twice.
Solution: Run a check in the AbstractCommandHandler to see if the modules have been built yet, and if they have don't attempt to build them again. All Command Handlers should share commands currently. In the future, there might be a need for a Command Handler to maintain it's own collection of commands, but then the building of commands could move to a virtual method and that handler can overwrite that method.
In https://github.com/Nikey646/Kuuhaku/commit/f386b595b78cc0615963804180903d9163f8a74a, the
CommandService
was made into a Singleton rather than declared per-class. This change didn't take into account the fact that multiple CommandHandlers could be created, and now the Modules and all their commands are being loaded into theCommandSerivce
twice.Solution: Run a check in the
AbstractCommandHandler
to see if the modules have been built yet, and if they have don't attempt to build them again. All Command Handlers should share commands currently. In the future, there might be a need for a Command Handler to maintain it's own collection of commands, but then the building of commands could move to a virtual method and that handler can overwrite that method.