API & Neuron
How to use the API that Synapse & Neuron Provides
Synapse is separated in multiple Services and each one is responsible for another Part of the Synapse API
The Player Service manage all Players, the Permission Service all Permissions and so on. This means you need to get them to get access to the API
How can I get a Service?
Every Service and almost all Handlers, even the ones from Plugins, will be created and binded by Neuron to the Kernel.
What does this Mean?
It means that Neuron stores all these objects like services and they can be accessed through Neuron.
To make this easier, can you use this static method:
This means if you want to get for Example the PlayerService can you just use Synapse.Get<PlayerService>()
to get it. This will as stated before work with almost all objects created by Neuron.
Another Example would be your own Plugin Class that you can always get with
Another Advantage of this is that we can properly resolve dependencies of a constructor.
Plugin and Modules class however needs to use the Inject Annotation since it is always the first object that is created and can't be resolved when it uses something that is created later
Plugin/Module classes can only use Inject.
They can't get any Services from the constructor
Most Services/Handlers can't use inject.
They have to get other Services through the constructor
Automatic
When working with Synapse 3 you will often see the Automatic Attribute
This attribute has no function itself, however it marks a Type as this should be Automatically be handled by a Neuron Module.
Depending on what Type it is on, will the module do something different but most often it just means: create this object after the Services are all ready and register it inside the Module API
Examples of use for the Automatic Attribute
Dependencies
When working with Synapse3 you will often work with Automatically created objects.
These can use every service however they will not be resolved between each other which means if you create for example 2 Commands Automatically and try to get one command in the constructor of the other this can throw an Error (if you're lucky the other Commands already exist and everything works fine but don't depend on this). If you really need to access the other Command store him inside your PluginClass and access it through the PluginClass later
This can throw an Error
All Synapse Services
SynapseCommandService
SynapseConfigService
DummyService
ItemService
ElevatorService
RoomService
SchematicService
CustomAttributeService
Scp914Service
CassieService
DecontaminationService
HeavyZoneService
IntercomService
MapService
NukeService
RoundService
PermissionService
RemoteAdminCategoryService
PlayerService
RoleService
TeamService
ServerService
Last updated