public IBrushInstance MakeInstance([NotNull] Player player, [NotNull] Command cmd, [NotNull] DrawOperation op) { if (player == null) { throw new ArgumentNullException("player"); } if (cmd == null) { throw new ArgumentNullException("cmd"); } if (op == null) { throw new ArgumentNullException("op"); } if (cmd.HasNext) { Block block = cmd.NextBlock(player); if (block == Block.Undefined) { return(null); } string brushName = cmd.Next(); if (brushName == null || !CommandManager.IsValidCommandName(brushName)) { player.Message("ReplaceBrush usage: &H/Brush rb <Block> <BrushName>"); return(null); } IBrushFactory brushFactory = BrushManager.GetBrushFactory(brushName); if (brushFactory == null) { player.Message("Unrecognized brush \"{0}\"", brushName); return(null); } IBrush replacement = brushFactory.MakeBrush(player, cmd); if (replacement == null) { return(null); } Block = block; Replacement = replacement; } ReplacementInstance = Replacement.MakeInstance(player, cmd, op); if (ReplacementInstance == null) { return(null); } return(new ReplaceBrushBrush(this)); }