public static void RequireFor(this PlayerInvokeOrigin origin, IInvokeSource source, string errorMessage = "Command is not available here.") { var playerSource = source as PlayerInvokeSource; if (playerSource != null) { if (playerSource.Origin != origin) { throw new InvalidInvokeOriginCommandException(errorMessage); } } }
public PlayerInvokeSource(Player player, PlayerInvokeOrigin origin, ReplyCallback onReply) : base(player.ChatName, onReply) { this.Player = player; this.Origin = origin; }