Table of Contents

Class StoreTagService

Namespace
McServerLauncher.Services
Assembly
McServerLauncher.dll

Turns a store item into the app's own tags.

Modrinth's categories are a good start but they are coarse — nearly half of the top server mods are filed under "utility" — and they don't say the one thing a server owner cares most about: whether players have to install the mod as well. So the categories are combined with keyword rules and with the client/server side, all of which live in Resources/store-tags.json.

The catalogue is read from the embedded copy, unless %APPDATA%\McServerLauncher\store-tags.json exists, in which case that file is used instead. Tags can therefore be added, translated, recoloured or re-mapped without a new build.

public sealed class StoreTagService
Inheritance
StoreTagService
Inherited Members

Constructors

StoreTagService(string?)

public StoreTagService(string? overridePath = null)

Parameters

overridePath string

Fields

TopicKind

The tags offered as filter chips for a given project type ("mod" or "plugin"), so a Paper server is not offered "Magic" and a Fabric server is not offered "Permissions & ranks".

public const string TopicKind = "topic"

Field Value

string

Properties

All

Every tag in the catalogue, ordered by priority.

public IReadOnlyList<StoreTagDefinition> All { get; }

Property Value

IReadOnlyList<StoreTagDefinition>

Shared

Shared instance; the catalogue is read once per run.

public static StoreTagService Shared { get; }

Property Value

StoreTagService

Methods

BrowseTags(string)

public IReadOnlyList<StoreTagDefinition> BrowseTags(string projectType)

Parameters

projectType string

Returns

IReadOnlyList<StoreTagDefinition>

Classify(StoreItem, int, string?)

The tags that apply to item, most important first. A tag applies when any of its rules matches; a project with no matching rule simply has no tags, which the UI shows by leaving the row out.

public IReadOnlyList<StoreTagDefinition> Classify(StoreItem item, int max = 2147483647, string? onlyKind = null)

Parameters

item StoreItem
max int
onlyKind string

Returns

IReadOnlyList<StoreTagDefinition>

Find(string)

Finds a tag by id; null when the catalogue doesn't define it.

public StoreTagDefinition? Find(string id)

Parameters

id string

Returns

StoreTagDefinition

LabelFor(StoreTagDefinition)

The tag's name in the interface language, falling back to English and finally to the raw id — a catalogue that forgot a translation still shows something usable.

public static string LabelFor(StoreTagDefinition tag)

Parameters

tag StoreTagDefinition

Returns

string