Skip to main content

PlayerConverter

A class in Root.Township, the global namespace.

Type converter that turns a string (username or user ID) into an online player, used for console command arguments.

Constructors​

MemberWhat it is
PlayerConverter()Creates a PlayerConverter with default values.

Properties​

MemberWhat it is
static IPlayer Last { get; private set; }The player from the last conversion, which stat converters use to look up stats.

Methods​

MemberWhat it is
override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)True for strings.
override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)Finds an online player by username or ID, ignoring case, then again ignoring spaces and underscores. Null if none.