Skip to main content

TavernServices

A static class in TavernLib, TavernLib.Services.

A small registry holding one object per type, where TavernLib keeps TavernManager and EntranceMessageHandler and mods can add their own. A plain dictionary with no lock.

Fields​

1 private and internal field
MemberWhat it is
private static readonly Dictionary<Type, IService> ServiceEntriesThe registered services, keyed by their type.

Methods​

MemberWhat it is
static void AddService<T>(T instance)Registers an instance under the generic type T. Logs a warning and does nothing if T is already registered.
static T GetService<T>()The instance registered under exactly T, or null with an error logged. On a client TavernManager is never there.