Skip to content

Dynamic Provider

Bankokwak edited this page May 23, 2025 · 2 revisions

Dynamic Provider are methods to create or remove Category with action, add or remove action to category.

You can use that everywhere. Example: Add category with action.

Provider.RegisterDynamicProvider("DynamicProviderTest", true, referenceHub => new List<DummyAction>()
{
  new DummyAction("DynamicTest", () =>
  {
     Log.Info("Test via DynamicProviderTest");
  })
}, allowPlayer);

Provider.UnregisterDynamicProvider($"DynamicProviderTest");

Add action and remove in category.

Provider.AddActionDynamic($"Jail/Room: {room.id}", new List<DummyAction>
{
    new DummyAction($"{pl.Nickname}", () =>
    {
         Provider.RemoveActionDynamic($"Jail/Room: {room.id}", pl.Nickname);
    })
});

If you name the action U-{name}, he can perform only 1 time even you multiselect.

And if you want a category for only a group of player you need to return a list of player after new List of DummyAction.

Table of content

Development

Clone this wiki locally