A static class in TavernLib, TavernLib.Patches.
Harmony patches on CommandService.HandleMatchedCommand and PlayerListConverter.ConvertFrom, so every console command's result reads properly: a player list that matched nobody is refused, and a thrown error shows its own message.
Fields
1 private and internal field
| Member | What it is |
|---|
private static readonly ConditionalWeakTable<PlayerList, string> Typed | The text typed for each PlayerList argument, kept so a refusal can quote it. |
Methods
| Member | What it is |
|---|
static bool RefuseEmptyPlayerList(CommandSearchResult matchedCommand, ref Task<CommandResult> __result) | Prefix on HandleMatchedCommand: skips the command when a PlayerList argument is empty, answering "No online player matches" with what was typed. |
static void RememberTypedPlayers(object value, object __result) | Postfix on PlayerListConverter.ConvertFrom that keeps the typed text with the resulting PlayerList, for the refusal message. |
static void UnwrapCommandError(ref Task<CommandResult> __result) | Postfix on HandleMatchedCommand that replaces a TargetInvocationException in the result with the command's own exception. |
1 private and internal method
| Member | What it is |
|---|
private static async Task<CommandResult> Unwrap(Task<CommandResult> pending) | Awaits a command's result and swaps a TargetInvocationException for the exception inside it. |