Pryaxis / orion-core

The next generation Terraria Server API.
https://pryaxis.github.io/orion-core
GNU General Public License v3.0
31 stars 12 forks source link

Fix plugin service binding #49

Closed mistzzt closed 4 years ago

mistzzt commented 6 years ago

This fixes binding with Plugin and SharedService. Previously, nothing will be bounden for plugins since they don't implement any interface. As a result, no plugins will be properly loaded on startup process from Orion.cs:

foreach (Plugin plugin in _injectionContainer.GetAll<Plugin>())

Not sure if this is the proper way to fix this problem; need to be reviewed.

Ijwu commented 6 years ago

Oh my lord, an Orion PR. I'm giddy!

That being said, I do not believe this is necessary. Since all plugins derive from Plugin requesting all Plugin from the container will fail. It looks like the best way to get an instance of a Plugin is to use service location. In other words: request its type directly from the kernel.

I do not know if this pattern is the intention. Paging @MarioE or @tylerjwatson. I think they might have the background knowledge on Plugin types.

mistzzt commented 6 years ago

If we want to request every possible plugin type, then it seems that the plugin loading process would have to be reconsidered (since it doesn't work now).

kevzhao2 commented 4 years ago

PR is outdated and is not applicable to the current dev progress.